Part Number Hot Search : 
SMCJ1 EVKIT HMC341 F9Z34N BF422A3 V22ZC1 EMV42GT 20ESB6
Product Description
Full Text Search
 

To Download PIC16F630 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ? 2006 microchip technology inc. ds40039d PIC16F630/676 data sheet 14-pin, flash-based 8-bit cmos microcontrollers
ds40039d-page ii ? 2006 microchip technology inc. information contained in this publication regarding device applications and the like is provided only for your convenience and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. microchip makes no representations or warranties of any kind whether express or implied, written or oral, statutory or otherwise, related to the information, including but not limited to its condition, quality, performance, merchantability or fitness for purpose . microchip disclaims all liability arising from this information and its use. use of microchip devices in life support and/or safety applications is entirely at the buyer?s risk, and the buyer agrees to defend, indemnify and hold harmless microchip from any and all damages, claims, suits, or expenses resulting from such use. no licenses are conveyed, implicitly or otherwise, under any microchip intellectual property rights. trademarks the microchip name and logo, the microchip logo, accuron, dspic, k ee l oq , micro id , mplab, pic, picmicro, picstart, pro mate, powersmart, rfpic and smartshunt are registered trademarks of micr ochip technology incorporated in the u.s.a. and other countries. amplab, filterlab, migratable memory, mxdev, mxlab, seeval, smartsensor and the embedded control solutions company are registered trademarks of microchip technology incorporated in the u.s.a. analog-for-the-digital age, appl ication maestro, codeguard, dspicdem, dspicdem.net, dspicworks, ecan, economonitor, fansense, flexrom, fuzzylab, in-circuit serial programming, icsp, icepic, linear active thermistor, mindi, miwi, mpasm, mplib, mplink, pickit, picdem, picdem.net, piclab, pictail, powercal, powerinfo, powermate, powe rtool, real ice, rflab, rfpicdem, select mode, smart serial, smarttel, total endurance, uni/o, wiperlock and zena are trademarks of microchip technology incorporated in the u.s.a. and other countries. sqtp is a service mark of mi crochip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2006, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. note the following details of the code protection feature on microchip devices: ? microchip products meet the specification cont ained in their particular microchip data sheet. ? microchip believes that its family of products is one of the mo st secure families of its kind on the market today, when used i n the intended manner and under normal conditions. ? there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowledge, require using the microchip produc ts in a manner outside the operating specif ications contained in microchip?s data sheets. most likely, the person doing so is engaged in theft of intellectual property. ? microchip is willing to work with the customer who is concerned about the integrity of their code. ? neither microchip nor any other semiconductor manufacturer c an guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ?unbreakable.? code protection is constantly evolving. we at microchip are co mmitted to continuously improvi ng the code protection features of our products. attempts to break microchip?s c ode protection feature may be a violation of the digital millennium copyright act. if such acts allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that act. microchip received iso/ts-16949:2002 certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona, gresham, oregon and mountain view, california. the company?s quality system processes and procedures are for its pic ? 8-bit mcus, k ee l oq ? code hopping devices, serial eeproms, microperipherals, nonvolatile memory and analog products. in addition, microchip?s quality system for the design and manufacture of development systems is iso 9001:2000 certified.
? 2006 microchip technology inc. ds40039d-page 1 PIC16F630/676 high performance risc cpu: ? only 35 instructions to learn - all single-cycle instructions except branches ? operating speed: - dc - 20 mhz oscillator/clock input - dc - 200 ns instruction cycle ? interrupt capability ? 8-level deep hardware stack ? direct, indirect, and relative addressing modes special microcontroller features: ? internal and external oscillator options - precision internal 4 mhz oscillator factory calibrated to 1% - external oscillator support for crystals and resonators -5 s wake-up from sleep, 3.0v, typical ? power saving sleep mode ? wide operating voltage range - 2.0v to 5.5v ? industrial and extended temperature range ? low power power-on reset (por) ? power-up timer (pwrt) and oscillator start-up timer (ost) ? brown-out detect (bod) ? watchdog timer (wdt) with independent oscillator for reliable operation ? multiplexed mclr /input-pin ? interrupt-on-pin change ? individual programmable weak pull-ups ? programmable code protection ? high endurance flash/eeprom cell - 100,000 write flash endurance - 1,000,000 write eeprom endurance - flash/data eeprom retention: > 40 years low power features: ? standby current: - 1 na @ 2.0v, typical ? operating current: -8.5 a @ 32 khz, 2.0v, typical -100 a @ 1 mhz, 2.0v, typical ? watchdog timer current - 300 na @ 2.0v, typical ? timer1 oscillator current: -4 a @ 32 khz, 2.0v, typical peripheral features: ? 12 i/o pins with individual direction control ? high current sink/source for direct led drive ? analog comparator module with: - one analog comparator - programmable on-chip comparator voltage reference (cv ref ) module - programmable input multiplexing from device inputs - comparator output is externally accessible ? analog-to-digital converter module (pic16f676): - 10-bit resolution - programmable 8-channel input - voltage reference input ? timer0: 8-bit timer/counter with 8-bit programmable prescaler ? enhanced timer1: - 16-bit timer/counter with prescaler - external gate input mode - option to use osc1 and osc2 in lp mode as timer1 oscillator, if intosc mode selected ? in-circuit serial programming tm (icsp tm ) via two pins device program memory data memory i/o 10-bit a/d (ch) comparators timers 8/16-bit flash (words) sram (bytes) eeprom (bytes) PIC16F630 1024 64 128 12 ? 1 1/1 pic16f676 1024 64 128 12 8 1 1/1 14-pin, flash-based 8-bi t cmos microcontroller
PIC16F630/676 ds40039d-page 2 ? 2006 microchip technology inc. pin diagrams 14-pin pdip, soic, tssop v dd ra5/t1cki/osc1/clkin ra4/t1g /osc2/an3/clkout ra3/mclr /v pp rc5 rc4 rc3/an7 v ss ra0/an0/cin+/icspdat ra1/an1/cin-/v ref /icspclk ra2/an2/cout/t0cki/int rc0/an4 rc1/an5 rc2/an6 pic16f676 1 2 3 4 5 6 7 14 13 12 9 11 10 8 v dd ra5/t1cki/osc1/clkin ra4/t1g /osc2/clkout ra3/mclr /v pp rc5 rc4 rc3 v ss ra0/cin+/icspdat ra1/cin-/icspclk ra2/cout/t0cki/int rc0 rc1 rc2 PIC16F630 1 2 3 4 5 6 7 14 13 12 9 11 10 8
? 2006 microchip technology inc. ds40039d-page 3 PIC16F630/676 table of contents 1.0 device overview ............................................................................................................ ............................................................. 5 2.0 memory organization ........................................................................................................ .......................................................... 7 3.0 ports a and c .............................................................................................................. .............................................................. 19 4.0 timer0 module .............................................................................................................. ............................................................ 29 5.0 timer1 module with gate control ............................................................................................. ................................................ 32 6.0 comparator module .......................................................................................................... ........................................................ 37 7.0 analog-to-digital converter (a/d) module (pic16f676 only) .................................................................. ................................. 43 8.0 data eeprom memory.......................................................................................................... .................................................. 49 9.0 special features of the cpu ................................................................................................ .................................................... 53 10.0 instruction set summary ................................................................................................... ........................................................ 71 11.0 development support ....................................................................................................... ........................................................ 79 12.0 electrical specifications ................................................................................................. ........................................................... 83 13.0 dc and ac characteristics graphs and tables ............................................................................... ...................................... 105 14.0 packaging information ..................................................................................................... ....................................................... 115 appendix a: data sheet revision history ....................................................................................... .................................................. 119 appendix b: device differences ................................................................................................ ....................................................... 119 appendix c: device migrations ................................................................................................. ........................................................ 120 appendix d: migrating from other pic ? devices ...................................................................................................................... ........ 120 index ......................................................................................................................... ........................................................................ 121 on-line support ............................................................................................................... ................................................................. 125 systems information and upgrade hot line ...................................................................................... ............................................... 125 reader response ............................................................................................................... .............................................................. 126 product identification system ................................................................................................. .......................................................... 127 to our valued customers it is our intention to provide our valued customers with the best documentation possible to ensure successful use of your micro chip products. to this end, we will continue to improve our publications to better suit your needs. our publications will be refined and enhanced as new volumes and updates are introduced. if you have any questions or comments regar ding this publication, please contact the marketing communications department via e-mail at docerrors@microchip.com or fax the reader response form in the back of this data sheet to (480) 792-4150. we welcome your feedback. most current data sheet to obtain the most up-to-date version of this data s heet, please register at our worldwide web site at: http://www.microchip.com you can determine the version of a data sheet by examining its literature number found on the bottom outside corner of any page . the last character of the literature number is the vers ion number, (e.g., ds30000a is version a of document ds30000). errata an errata sheet, describing minor operational differences fr om the data sheet and recommended workarounds, may exist for curren t devices. as device/doc umentation issues become known to us, we will publis h an errata sheet. the errata will specify the revisi on of silicon and revision of document to which it applies. to determine if an errata sheet exists for a particul ar device, please check with one of the following: ? microchip?s worldwide web site; http://www.microchip.com ? your local microchip sales office (see last page) when contacting a sales office, please spec ify which device, revision of silicon and data sheet (include literature number) you are using. customer notification system register on our web site at www.microchip.com to receive the most current information on all of our products.
PIC16F630/676 ds40039d-page 4 ? 2006 microchip technology inc. notes:
? 2006 microchip technology inc. ds40039d-page 5 PIC16F630/676 1.0 device overview this document contains device specific information for the PIC16F630/676. additional information may be found in the pic ? mid-range reference manual (ds33023), which may be obtained from your local microchip sales representative or downloaded from the microchip web site. the reference manual should be considered a complementary document to this data sheet and is highly recommended reading for a better understanding of the device architecture and operation of the peripheral modules. the PIC16F630 and pic16f676 devices are covered by this data sheet. they are identical, except the pic16f676 has a 10-bit a/d converter. they come in 14-pin pdip, soic and tssop packages. figure 1-1 shows a block diagram of the PIC16F630/676 devices. table 1-1 shows the pinout description. figure 1-1: pic16f63 0/676 block diagram flash program memory 13 data bus 8 14 program bus instruction reg program counter ram file registers direct addr 7 ram addr 9 addr mux indirect addr fsr reg status reg mux alu w reg instruction decode & control timing generation osc1/clkin osc2/clkout porta 8 8 8 3 8-level stack 64 1k x 14 bytes (13-bit) power-up timer oscillator start-up timer power-on reset watchdog timer mclr v ss brown-out detect analog timer0 timer1 data eeprom 128 bytes eedata eeaddr ra0 ra1 ra2 ra3 ra4 ra5 comparator analog to digital converter ( pic16f676 only) an0 an1 an2 an3 cin- cin+ cout t0cki int t1cki configuration internal oscillator v ref and reference t1 g portc rc0 rc1 rc2 rc3 rc4 rc5 an4 an5 an6 an7 v dd 8
PIC16F630/676 ds40039d-page 6 ? 2006 microchip technology inc. table 1-1: PIC16F630/676 pinout description name function input type output type description ra0/an0/cin+/icspdat ra0 ttl cmos bi-directional i/o w/ programmable pull-up and interrupt-on-change an0 an ? a/d channel 0 input cin+ an comparator input icspdat ttl cmos serial programming data i/o ra1/an1/cin-/v ref / icspclk ra1 ttl cmos bi-directional i/o w/ programmable pull-up and interrupt-on-change an1 an ? a/d channel 1 input cin- an ? comparator input v ref an ? external voltage reference icspclk st ? serial programming clock ra2/an2/cout/t0cki/int ra2 st cmos bi-directional i/o w/ programmable pull-up and interrupt-on-change an2 an ? a/d channel 2 input cout ? cmos comparator output t0cki st ? timer0 clock input int st ? external interrupt ra3/mclr /v pp ra3 ttl ? input port with interrupt-on-change mclr st ? master clear v pp hv ? programming voltage ra4/t1g /an3/osc2/ clkout ra4 ttl cmos bi-directional i/o w/ programmable pull-up and interrupt-on-change t1g st ? timer1 gate an3 an3 ? a/d channel 3 input osc2 ? xtal crystal/resonator clkout ? cmos f osc /4 output ra5/t1cki/osc1/clkin ra5 ttl cmos bi-directional i/o w/ programmable pull-up and interrupt-on-change t1cki st ? timer1 clock osc1 xtal ? crystal/resonator clkin st ? external clock input/rc oscillator connection rc0/an4 rc0 ttl cmos bi-directional i/o an4 an4 ? a/d channel 4 input rc1/an5 rc1 ttl cmos bi-directional i/o an5 an5 ? a/d channel 5 input rc2/an6 rc2 ttl cmos bi-directional i/o an6 an6 ? a/d channel 6 input rc3/an7 rc3 ttl cmos bi-directional i/o an7 an7 ? a/d channel 7 input rc4 rc4 ttl cmos bi-directional i/o rc5 rc5 ttl cmos bi-directional i/o v ss v ss power ? ground reference v dd v dd power ? positive supply legend: shade = pic16f676 only ttl = ttl input buffer st = schmitt trigger input buffer
? 2006 microchip technology inc. ds40039d-page 7 PIC16F630/676 2.0 memory organization 2.1 program memory organization the PIC16F630/676 devices have a 13-bit program counter capable of addressing an 8k x 14 program memory space. only the first 1k x 14 (0000h - 03ffh) for the PIC16F630/676 devices is physically imple- mented. accessing a location above these boundaries will cause a wrap around within the first 1k x 14 space. the reset vector is at 0000h and the interrupt vector is at 0004h (see figure 2-1). figure 2-1: program memory map and stack for the PIC16F630/676 2.2 data memory organization the data memory (see figure 2-2) is partitioned into two banks, which contain the general purpose regis- ters and the special function registers. the special function registers are located in the first 32 locations of each bank. register locations 20h-5fh are general purpose registers, implemented as static ram and are mapped across both banks. all other ram is unimplemented and returns ?0? when read. rp0 (status<5>) is the bank select bit. ? rp0 = 0 bank 0 is selected ? rp0 = 1 bank 1 is selected 2.2.1 general purpose register file the register file is organized as 64 x 8 in the PIC16F630/676 devices. each register is accessed, either directly or indirectly, through the file select register fsr (see section 2.4). pc<12:0> 13 000h 0004 0005 03ffh 0400h 1fffh stack level 1 stack level 8 reset vector interrupt vector on-chip program memory call, return retfie, retlw stack level 2 note: the irp and rp1 bits status<7:6> are reserved and should always be maintained as ?0?s.
PIC16F630/676 ds40039d-page 8 ? 2006 microchip technology inc. 2.2.2 special function registers the special function registers are registers used by the cpu and peripheral functions for controlling the desired operation of the device (see table 2-1). these registers are static ram. the special registers can be classified into two sets: core and peripheral. the special function registers associated with the ?core? are described in this section. those related to the operation of the peripheral features are described in the section of that peripheral feature. figure 2-2: data memory map of the PIC16F630/676 indirect addr. (1) tmr0 pcl status fsr porta pclath intcon pir1 tmr1l tmr1h t1con 00h 01h 02h 03h 04h 05h 06h 07h 08h 09h 0ah 0bh 0ch 0dh 0eh 0fh 10h 11h 12h 13h 14h 15h 16h 17h 18h 19h 1ah 1bh 1ch 1dh 1eh 1fh 20h 7fh bank 0 unimplemented data memory locations, read as '0'. 1: not a physical register. 2: pic16f676 only. cmcon vrcon general purpose registers accesses 20h-5fh 64 bytes eedat eeadr eecon2 (1) 5fh 60h file address file address wpua ioca indirect addr. (1) option_reg pcl status fsr trisa pclath intcon pie1 pcon osccal 80h 81h 82h 83h 84h 85h 86h 87h 88h 89h 8ah 8bh 8ch 8dh 8eh 8fh 90h 91h 92h 93h 94h 95h 96h 97h 98h 99h 9ah 9bh 9ch 9dh 9eh 9fh a0h ffh bank 1 dfh e0h adresh (2) adcon0 (2) eecon1 adresl (2) adcon1 (2) ansel (2) trisc portc
? 2006 microchip technology inc. ds40039d-page 9 PIC16F630/676 table 2-1: PIC16F630/676 special registers summary bank 0 addrnamebit 7bit 6bit 5bit 4bit 3bit 2 bit 1bit 0 value on por, bod page bank 0 00h indf addressing this location uses contents of fsr to address data memory (not a physical register) xxxx xxxx 18,61 01h tmr0 timer0 module?s register xxxx xxxx 29 02h pcl program counter's (pc) least significant byte 0000 0000 17 03h status irp (2) rp1 (2) rp0 to pd zdcc 0001 1xxx 11 04h fsr indirect data memory address pointer xxxx xxxx 18 05h porta ? ? i/o control registers --xx xxxx 19 06h ? unimplemented ? ? 07h portc ? ? i/o control registers --xx xxxx 26 08h ? unimplemented ? ? 09h ? unimplemented ? ? 0ah pclath ? ? ? write buffer for upper 5 bits of program counter ---0 0000 17 0bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 13 0ch pir1 eeif adif ? ?cmif ? ?tmr1if 00-- 0--0 15 0dh ? unimplemented ? ? 0eh tmr1l holding register for the least significant byte of the 16-bit tmr1 xxxx xxxx 32 0fh tmr1h holding register for the most significant byte of the 16-bit tmr1 xxxx xxxx 32 10h t1con ? t1ge t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on -000 0000 34 11h ? unimplemented ? ? 12h ? unimplemented ? ? 13h ? unimplemented ? ? 14h ? unimplemented ? ? 15h ? unimplemented ? ? 16h ? unimplemented ? ? 17h ? unimplemented ? ? 18h ? unimplemented ? ? 19h cmcon ?cout ? cinv cis cm2 cm1 cm0 -0-0 0000 37 1ah ? unimplemented ? ? 1bh ? unimplemented ? ? 1ch ? unimplemented ? ? 1dh ? unimplemented ? ? 1eh adresh (3) most significant 8 bits of the left shifted a/d result or 2 bits of right shifted result xxxx xxxx 44 1fh adcon0 (3) adfm vcfg ? chs2 chs1 chs0 go/done adon 00-0 0000 45,61 legend: ? = unimplemented locations read as ?0?, u = unchanged, x = unknown, q = value depends on condition shaded = unimplemented note 1: other (non power-up) resets include mclr reset, brown-out detect and watchdog timer reset during normal operation. 2: irp & rp1 bits are reserved, always maintain these bits clear. 3: pic16f676 only.
PIC16F630/676 ds40039d-page 10 ? 2006 microchip technology inc. table 2-2: PIC16F630/676 special function registers summary bank 1 addrname bit 7bit 6bit 5bit 4bit 3bit 2 bit 1bit 0 value on por, bod page bank 1 80h indf addressing this location uses contents of fsr to address data memory (not a physical register) xxxx xxxx 18,61 81h option_reg rapu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 12,30 82h pcl program counter's (pc) least significant byte 0000 0000 17 83h status irp (2) rp1 (2) rp0 to pd zdcc 0001 1xxx 11 84h fsr indirect data memory address pointer xxxx xxxx 18 85h trisa ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 --11 1111 19 86h ? unimplemented ? ? 87h trisc ? ? trisc5 trisc4 trisc3 t risc2 trisc1 trisc0 --11 1111 ? 88h ? unimplemented ? ? 89h ? unimplemented ? ? 8ah pclath ? ? ? write buffer for upper 5 bits of program counter ---0 0000 17 8bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 13 8ch pie1 eeie adie ? ?cmie ? ?tmr1ie 00-- 0--0 14 8dh ? unimplemented ? ? 8eh pcon ? ? ? ? ? ?por bod ---- --qq 16 8fh ? ? 90h osccal cal5 cal4 cal3 cal2 cal1 cal0 ? ? 1000 00-- 16 91h ansel (3) ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 1111 1111 46 92h ? unimplemented ? ? 93h ? unimplemented ? ? 94h ? unimplemented ? ? 95h wpua ? ? wpua5 wpua4 ? wpua2 wpua1 wpua0 --11 -111 20 96h ioca ? ? ioca5 ioca4 ioca3 ioca2 ioca1 ioca0 --00 0000 21 97h ? unimplemented ? ? 98h ? unimplemented ? ? 99h vrcon vren ?vrr ? vr3 vr2 vr1 vr0 0-0- 0000 42 9ah eedat eeprom data register 0000 0000 49 9bh eeadr ? eeprom address register 0000 0000 49 9ch eecon1 ? ? ? ? wrerr wren wr rd ---- x000 50 9dh eecon2 eeprom control register 2 (not a physical register) ---- ---- 49 9eh adresl (3) least significant 2 bits of the left shifted result or 8 bits of the right shifted result xxxx xxxx 44 9fh adcon1 (3) ? adcs2 adcs1 adcs0 ? ? ? ? -000 ---- 45,61 legend: ? = unimplemented locations read as ?0?, u = unchanged, x = unknown, q = value depends on condition, shaded = unimplemented note 1: other (non power-up) resets include mclr reset, brown-out detect and watchdog timer reset during normal operation. 2: irp & rp1 bits are reserved, always maintain these bits clear. 3: pic16f676 only.
? 2006 microchip technology inc. ds40039d-page 11 PIC16F630/676 2.2.2.1 status register the status register, shown in register 2-1, contains: ? the arithmetic status of the alu ? the reset status ? the bank select bits for data memory (sram) the status register can be the destination for any instruction, like any other register. if the status register is the destination for an instruction that affects the z, dc or c bits, then the write to these three bits is disabled. these bits are set or cleared according to the device logic. furthermore, the to and pd bits are not writable. therefore, the result of an instruction with the status register as destination may be different than intended. for example, clrf status will clear the upper three bits and set the z bit. this leaves the status register as 000u u1uu (where u = unchanged). it is recommended, therefore, that only bcf, bsf, swapf and movwf instructions are used to alter the status register, because these instructions do not affect any status bits. for other instructions not affecting any status bits, see the ?instruction set summary?. register 2-1: status ? status register (address: 03h or 83h) note 1: bits irp and rp1 (status<7:6>) are not used by the PIC16F630/676 and should be maintained as clear. use of these bits is not recommended, since this may affect upward compatibility with future products. 2: the c and dc bits operate as a borrow and digit borrow out bit, respectively, in subtraction. see the sublw and subwf instructions for examples. reserved reserved r/w-0 r-1 r-1 r/w-x r/w-x r/w-x irp rp1 rp0 to pd zdcc bit 7 bit 0 bit 7 irp: this bit is reserved and should be maintained as ?0? bit 6 rp1: this bit is reserved and should be maintained as ?0? bit 5 rp0: register bank select bit (used for direct addressing) 1 = bank 1 (80h - ffh) 0 = bank 0 (00h - 7fh) bit 4 to : time-out bit 1 = after power-up, clrwdt instruction, or sleep instruction 0 = a wdt time-out occurred bit 3 pd : power-down bit 1 = after power-up or by the clrwdt instruction 0 = by execution of the sleep instruction bit 2 z : zero bit 1 = the result of an arithmetic or logic operation is zero 0 = the result of an arithmetic or logic operation is not zero bit 1 dc : digit carry/borrow bit ( addwf , addlw,sublw,subwf instructions) for borrow, the polarity is reversed. 1 = a carry-out from the 4th low order bit of the result occurred 0 = no carry-out from the 4th low order bit of the result bit 0 c : carry/borrow bit ( addwf , addlw, sublw, subwf instructions) 1 = a carry-out from the most significant bit of the result occurred 0 = no carry-out from the most significant bit of the result occurred note: for borrow the polarity is reversed. a subtraction is executed by adding the two?s complement of the second operand. for rotate ( rrf , rlf ) instructions, this bit is loaded with either the high or low order bit of the source register. legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
PIC16F630/676 ds40039d-page 12 ? 2006 microchip technology inc. 2.2.2.2 option register the option register is a readable and writable register, which contains various control bits to configure: ? tmr0/wdt prescaler ? external ra2/int interrupt ?tmr0 ? weak pull-ups on porta register 2-2: option_reg ? option register (address: 81h) note: to achieve a 1:1 prescaler assignment for tmr0, assign the prescaler to the wdt by setting psa bit to ?1? (option<3>). see section 4.4. r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 rapu intedg t0cs t0se psa ps2 ps1 ps0 bit 7 bit 0 bit 7 rapu : porta pull-up enable bit 1 = porta pull-ups are disabled 0 = porta pull-ups are enabled by individual port latch values bit 6 intedg: interrupt edge select bit 1 = interrupt on rising edge of ra2/int pin 0 = interrupt on falling edge of ra2/int pin bit 5 t0cs: tmr0 clock source select bit 1 = transition on ra2/t0cki pin 0 = internal instruction cycle clock (clkout) bit 4 t0se: tmr0 source edge select bit 1 = increment on high-to-low transition on ra2/t0cki pin 0 = increment on low-to-high transition on ra2/t0cki pin bit 3 psa: prescaler assignment bit 1 = prescaler is assigned to the wdt 0 = prescaler is assigned to the timer0 module bit 2-0 ps2:ps0: prescaler rate select bits legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown 000 001 010 011 100 101 110 111 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 1 : 256 1 : 1 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 bit value tmr0 rate wdt rate
? 2006 microchip technology inc. ds40039d-page 13 PIC16F630/676 2.2.2.3 intcon register the intcon register is a readable and writable register, which contains the various enable and flag bits for tmr0 register overflow, porta change and external ra2/int pin interrupts. register 2-3: intcon ? interrupt control register (address: 0bh or 8bh) note: interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie (intcon<7>). user software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 gie peie t0ie inte raie t0if intf raif bit 7 bit 0 bit 7 gie: global interrupt enable bit 1 = enables all unmasked interrupts 0 = disables all interrupts bit 6 peie: peripheral interrupt enable bit 1 = enables all unmasked peripheral interrupts 0 = disables all peripheral interrupts bit 5 t0ie: tmr0 overflow interrupt enable bit 1 = enables the tmr0 interrupt 0 = disables the tmr0 interrupt bit 4 inte: ra2/int external interrupt enable bit 1 = enables the ra2/int external interrupt 0 = disables the ra2/int external interrupt bit 3 raie: port change interrupt enable bit (1) 1 = enables the porta change interrupt 0 = disables the porta change interrupt bit 2 t0if: tmr0 overflow interrupt flag bit (2) 1 = tmr0 register has overflowed (must be cleared in software) 0 = tmr0 register did not overflow bit 1 intf: ra2/int external interrupt flag bit 1 = the ra2/int external interrupt occurred (must be cleared in software) 0 = the ra2/int external interrupt did not occur bit 0 raif: port change interrupt flag bit 1 = when at least one of the porta <5:0> pins changed state (must be cleared in software) 0 = none of the porta <5:0> pins have changed state note 1: ioca register must also be enabled. 2: t0if bit is set when timer0 rolls over. timer0 is unchanged on reset and should be initialized before clearing t0if bit. legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
PIC16F630/676 ds40039d-page 14 ? 2006 microchip technology inc. 2.2.2.4 pie1 register the pie1 register contains the interrupt enable bits, as shown in register 2-4. register 2-4: pie1 ? peripheral interrupt enable register 1 (address: 8ch) note: bit peie (intcon<6>) must be set to enable any peripheral interrupt. r/w-0 r/w-0 u-0 u-0 r/w-0 u-0 u-0 r/w-0 eeie adie ? ? cmie ? ? tmr1ie bit 7 bit 0 bit 7 eeie: ee write complete interrupt enable bit 1 = enables the ee write complete interrupt 0 = disables the ee write complete interrupt bit 6 adie: a/d converter interrupt enable bit (pic16f676 only) 1 = enables the a/d converter interrupt 0 = disables the a/d converter interrupt bit 5-4 unimplemented: read as ?0? bit 3 cmie: comparator interrupt enable bit 1 = enables the comparator interrupt 0 = disables the comparator interrupt bit 2-1 unimplemented: read as ?0? bit 0 tmr1ie: tmr1 overflow interrupt enable bit 1 = enables the tmr1 overflow interrupt 0 = disables the tmr1 overflow interrupt legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
? 2006 microchip technology inc. ds40039d-page 15 PIC16F630/676 2.2.2.5 pir1 register the pir1 register contains the interrupt flag bits, as shown in register 2-5. register 2-5: pir1 ? peripheral interrupt register 1 (address: 0ch) note: interrupt flag bits are set when an interrupt condition occurs, regardless of the state of its corresponding enable bit or the global enable bit, gie (intcon<7>). user software should ensure the appropriate interrupt flag bits are clear prior to enabling an interrupt. r/w-0 r/w-0 u-0 u-0 r/w-0 u-0 u-0 r/w-0 eeif adif ? ?cmif ? ?tmr1if bit 7 bit 0 bit 7 eeif: eeprom write operation interrupt flag bit 1 = the write operation completed (must be cleared in software) 0 = the write operation has not completed or has not been started bit 6 adif: a/d converter interrupt flag bit (pic16f676 only) 1 = the a/d conversion is complete (must be cleared in software) 0 = the a/d conversion is not complete bit 5-4 unimplemented : read as ?0? bit 3 cmif : comparator interrupt flag bit 1 = comparator input has changed (must be cleared in software) 0 = comparator input has not changed bit 2-1 unimplemented : read as ?0? bit 0 tmr1if : tmr1 overflow interrupt flag bit 1 = tmr1 register overflowed (must be cleared in software) 0 = tmr1 register did not overflow legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
PIC16F630/676 ds40039d-page 16 ? 2006 microchip technology inc. 2.2.2.6 pcon register the power control (pcon) register contains flag bits to differentiate between a: ? power-on reset (por) ? brown-out detect (bod) ? watchdog timer reset (wdt) ? external mclr reset the pcon register bits are shown in register 2-6. register 2-6: pcon ? power control register (address: 8eh) 2.2.2.7 osccal register the oscillator calibration register (osccal) is used to calibrate the internal 4 mhz oscillator. it contains 6 bits to adjust the frequency up or down to achieve 4 mhz. the osccal register bits are shown in register 2-7. register 2-7: osccal ? internal oscillator calibration register (address: 90h) u-0 u-0 u-0 u-0 u-0 u-0 r/w-0 r/w-x ? ? ? ? ? ?por bod bit 7 bit 0 bit 7-2 unimplemented: read as '0' bit 1 por : power-on reset status bit 1 = no power-on reset occurred 0 = a power-on reset occurred (must be set in software after a power-on reset occurs) bit 0 bod : brown-out detect status bit 1 = no brown-out detect occurred 0 = a brown-out detect occurred (must be set in software after a brown-out detect occurs) legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown r/w-1 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 u-0 u-0 cal5 cal4 cal3 cal2 cal1 cal0 ? ? bit 7 bit 0 bit 7-2 cal5:cal0: 6-bit signed oscillator calibration bits 111111 = maximum frequency 100000 = center frequency 000000 = minimum frequency bit 1-0 unimplemented: read as '0' legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
? 2006 microchip technology inc. ds40039d-page 17 PIC16F630/676 2.3 pcl and pclath the program counter (pc) is 13-bits wide. the low byte comes from the pcl register, which is a readable and writable register. the high byte (pc<12:8>) is not directly readable or writable and comes from pclath. on any reset, the pc is cleared. figure 2-3 shows the two situations for the loading of the pc. the upper example in figure 2-3 shows how the pc is loaded on a write to pcl (pclath<4:0> pch). the lower example in figure 2-3 shows how the pc is loaded during a call or goto instruction (pclath<4:3> pch). figure 2-3: loading of pc in different situations 2.3.1 computed goto a computed goto is accomplished by adding an offset to the program counter ( addwf pcl ). when perform- ing a table read using a computed goto method, care should be exercised if the table location crosses a pcl memory boundary (each 256-byte block). refer to the application note ?implementing a table read" (an556). 2.3.2 stack the PIC16F630/676 family has an 8-level x 13-bit wide hardware stack (see figure 2-1). the stack space is not part of either program or data space and the stack pointer is not readable or writable. the pc is pushed onto the stack when a call instruction is executed or an interrupt causes a branch. the stack is poped in the event of a return, retlw or a retfie instruction execution. pclath is not affected by a push or pop operation. the stack operates as a circular buffer. this means that after the stack has been pushed eight times, the ninth push overwrites the value that was stored from the first push. the tenth push overwrites the second push (and so on). pc 12 8 7 0 5 pclath<4:0> pclath instruction with alu result goto, call opcode <10:0> 8 pc 12 11 10 0 11 pclath<4:3> pch pcl 87 2 pclath pch pcl pcl as destination note 1: there are no status bits to indicate stack overflow or stack underflow conditions. 2: there are no instructions/mnemonics called push or pop. these are actions that occur from the execution of the call, return, retlw and retfie instructions or the vectoring to an interrupt address.
PIC16F630/676 ds40039d-page 18 ? 2006 microchip technology inc. 2.4 indirect addressing, indf and fsr registers the indf register is not a physical register. addressing the indf register will cause indirect addressing. indirect addressing is possible by using the indf register. any instruction using the indf register actually accesses data pointed to by the file select register (fsr). reading indf itself indirectly will produce 00h. writing to the indf register indirectly results in a no operation (although status bits may be affected). an effective 9-bit address is obtained by concatenating the 8-bit fsr register and the irp bit (status<7>), as shown in figure 2-4. a simple program to clear ram location 20h-2fh using indirect addressing is shown in example 2-1. example 2-1: indirect addressing figure 2-4: direct/indirect addressing PIC16F630/676 movlw 0x20 ;initialize pointer movwf fsr ;to ram next clrf indf ;clear indf register incf fsr ;inc pointer btfss fsr,4 ;all done? goto next ;no clear next continue ;yes continue for memory map detail see figure 2-2. note 1: the rp1 and irp bits are reserved; always maintain these bits clear. data memory indirect addressing direct addressing bank select location select rp1 (1) rp0 6 0 from opcode irp (1) fsr register 7 0 bank select location select 00 01 10 11 180h 1ffh 00h 7fh bank 0 bank 1 bank 2 bank 3 not used
? 2006 microchip technology inc. ds40039d-page 19 PIC16F630/676 3.0 ports a and c there are as many as twelve general purpose i/o pins available. depending on which peripherals are enabled, some or all of the pins may not be available as general purpose i/o. in general, when a peripheral is enabled, the associated pin may not be used as a general purpose i/o pin. 3.1 porta and the trisa registers porta is an 6-bit wide, bi-directional port. the corre- sponding data direction register is trisa. setting a trisa bit (= 1) will make the corresponding porta pin an input (i.e., put the corresponding output driver in a hi-impedance mode). clearing a trisa bit (= 0) will make the corresponding porta pin an output (i.e., put the contents of the output latch on the selected pin). the exception is ra3, which is input only and its tris bit will always read as ?1?. example 3-1 shows how to initialize porta. reading the porta register reads the status of the pins, whereas writing to it will write to the port latch. all write operations are read-modify-write operations. therefore, a write to a port implies that the port pins are read, this value is modified and then written to the port data latch. ra3 reads ?0? when mclren = 1. the trisa register controls the direction of the porta pins, even when they are being used as analog inputs. the user must ensure the bits in the trisa register are maintained set when using them as analog inputs. i/o pins configured as analog input always read ?0?. example 3-1: initializing porta 3.2 additional pin functions every porta pin on the PIC16F630/676 has an interrupt-on-change option and every porta pin, except ra3, has a weak pull-up option. the next two sections describe these functions. 3.2.1 weak pull-up each of the porta pins, except ra3, has an individu- ally configurable weak internal pull-up. control bits wpuax enable or disable each pull-up. refer to register 3-3. each weak pull-up is automatically turned off when the port pin is configured as an output. the pull-ups are disabled on a power-on reset by the rapu bit (option<7>). register 3-1: porta ? porta register (address: 05h) note: additional information on i/o ports may be found in the pic ? mid-range reference manual, (ds33023) note: the ansel (91h) and cmcon (19h) registers must be initialized to configure an analog channel as a digital input. pins configured as analog inputs will read ?0?. the ansel register is defined for the pic16f676. bcf status,rp0 ;bank 0 clrf porta ;init porta movlw 05h ;set ra<2:0> to movwf cmcon ;digital i/o bsf status,rp0 ;bank 1 clrf ansel ;digital i/o movlw 0ch ;set ra<3:2> as inputs movwf trisa ;and set ra<5:4,1:0> ;as outputs bcf status,rp0 ;bank 0 u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? ? ra5 ra4 ra3 ra2 ra1 ra0 bit 7 bit 0 bit 7-6: unimplemented : read as ?0? bit 5-0: porta<5:0> : porta i/o pin 1 = port pin is >v ih 0 = port pin is PIC16F630/676 ds40039d-page 20 ? 2006 microchip technology inc. register 3-2: trisa ? porta tristate register (address: 85h) register 3-3: wpua ? weak pull-up register (address: 95h) 3.2.2 interrupt-on-change each of the porta pins is individually configurable as an interrupt-on-change pin. control bits iocax enable or disable the interrupt function for each pin. refer to register 3-4. the interrupt-on-change is disabled on a power-on reset. for enabled interrupt-on-change pins, the values are compared with the old value latched on the last read of porta. the ?mismatch? outputs of the last read are or'd together to set, the porta change interrupt flag bit (raif) in the intcon register. this interrupt can wake the device from sleep. the user, in the interrupt service routine, can clear the interrupt in the following manner: a) any read or write of porta. this will end the mismatch condition. b) clear the flag bit raif. a mismatch condition will continue to set flag bit raif. reading porta will end the mismatch condition and allow flag bit raif to be cleared. u-0 u-0 r/w-x r/w-x r-1 r/w-x r/w-x r/w-x ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 bit 7 bit 0 bit 7-6: unimplemented : read as ?0? bit 5-0: trisa<5:0> : porta tri-state control bit 1 = porta pin configured as an input (tri-stated) 0 = porta pin configured as an output note: trisa<3> always reads 1. legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown u-0 u-0 r/w-1 r/w-1 u-0 r/w-1 r/w-1 r/w-1 ? ? wpua5 wpua4 ? wpua2 wpua1 wpua0 bit 7 bit 0 bit 7-6 unimplemented: read as ?0? bit 5-4 wpua<5:4>: weak pull-up register bit 1 = pull-up enabled 0 = pull-up disabled bit 3 unimplemented: read as ?0? bit 2-0 wpua<2:0>: weak pull-up register bit 1 = pull-up enabled 0 = pull-up disabled note 1: global rapu must be enabled for individual pull-ups to be enabled. 2: the weak pull-up device is automatically disabled if the pin is in output mode (trisa = 0). legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown note: if a change on the i/o pin should occur when the read operation is being executed (start of the q2 cycle), then the raif interrupt flag may not get set.
? 2006 microchip technology inc. ds40039d-page 21 PIC16F630/676 register 3-4: ioca ? interrupt-on-change porta register (address: 96h) u-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? ? ioca5 ioca4 ioca3 ioca2 ioca1 ioca0 bit 7 bit 0 bit 7-6 unimplemented: read as ?0? bit 5-0 ioca<5:0>: interrupt-on-change porta control bit 1 = interrupt-on-change enabled 0 = interrupt-on-change disabled note: global interrupt enable (gie) must be enabled for individual interrupts to be recognized. legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
PIC16F630/676 ds40039d-page 22 ? 2006 microchip technology inc. 3.2.3 pin descriptions and diagrams each porta pin is multiplexed with other functions. the pins and their combined functions are briefly described here. for specific information about individ- ual functions such as the comparator or the a/d, refer to the appropriate section in this data sheet. 3.2.3.1 ra0/an0/cin+ figure 3-1 shows the diagram for this pin. the ra0 pin is configurable to function as one of the following: ? a general purpose i/o ? an analog input for the a/d (pic16f676 only) ? an analog input to the comparator 3.2.3.2 ra1/an1/cin-/v ref figure 3-1 shows the diagram for this pin. the ra1 pin is configurable to function as one of the following: ? as a general purpose i/o ? an analog input for the a/d (pic16f676 only) ? an analog input to the comparator ? a voltage reference input for the a/d (pic16f676 only) figure 3-1: block diagram of ra0 and ra1 pins i/o pin v dd v ss d q ck q d q ck q d q ck q d q ck q v dd d en q d en q weak data bus wr wpua rd wpua rd porta rd porta wr porta wr trisa rd trisa wr ioca rd ioca interrupt-on-change to comparator to a/d converter analog input mode rapu analog input mode
? 2006 microchip technology inc. ds40039d-page 23 PIC16F630/676 3.2.3.3 ra2/an2/t0cki/int/cout figure 3-2 shows the diagram for this pin. the ra2 pin is configurable to function as one of the following: ? a general purpose i/o ? an analog input for the a/d (pic16f676 only) ? a digital output from the comparator ? the clock input for tmr0 ? an external edge triggered interrupt figure 3-2: block diagram of ra2 3.2.3.4 ra3/mclr /v pp figure 3-3 shows the diagram for this pin. the ra3 pin is configurable to function as one of the following: ? a general purpose input ? as master clear reset figure 3-3: block diagram of ra3 i/o pin v dd v ss d q ck q d q ck q d q ck q d q ck q v dd d en q d en q weak analog input mode data bus wr wpua rd wpua rd porta wr porta wr trisa rd trisa wr ioca rd ioca interrupt-on-change to a/d converter 0 1 cout cout enable to i n t to t m r 0 analog input mode rapu rd porta analog input mode i/o pin v ss d q ck q d en q data bus rd porta rd porta wr ioca rd ioca interrupt-on-change reset mclre rd trisa v ss d en q mclre
PIC16F630/676 ds40039d-page 24 ? 2006 microchip technology inc. 3.2.3.5 ra4/an3/t1g /osc2/clkout figure 3-4 shows the diagram for this pin. the ra4 pin is configurable to function as one of the following: ? a general purpose i/o ? an analog input for the a/d (pic16f676 only) ? a tmr1 gate input ? a crystal/resonator connection ? a clock output figure 3-4: block diagram of ra4 3.2.3.6 ra5/t1cki/osc1/clkin figure 3-5 shows the diagram for this pin. the ra5 pin is configurable to function as one of the following: ? a general purpose i/o ?a tmr1 clock input ? a crystal/resonator connection ? a clock input figure 3-5: block diagram of ra5 i/o pin v dd v ss d q ck q d q ck q d q ck q d q ck q v dd d en q d en q weak analog input mode data bus wr wpua rd wpua rd porta wr porta wr trisa rd trisa wr ioca rd ioca interrupt-on-change f osc /4 to a/d converter oscillator circuit osc1 clkout 0 1 clkout enable enable analog input mode rapu rd porta to tmr1 t1g intosc/ rc/ec (2) clk (1) modes clkout enable note 1: clk modes are xt, hs, lp, lptmr1 and clkout enable. 2: with clkout option. i/o pin v dd v ss d q ck q d q ck q d q ck q d q ck q v dd d en q d en q weak data bus wr wpua rd wpua rd porta wr porta wr trisa rd trisa wr ioca rd ioca interrupt-on-change to tmr1 or clkgen intosc mode rd porta intosc mode rapu oscillator circuit osc2 (1) note 1: timer1 lp oscillator enabled. 2: when using timer1 with lp oscillator, the schmitt trigger is by-passed. tmr1lpen (1)
? 2006 microchip technology inc. ds40039d-page 25 PIC16F630/676 table 3-1: summary of registers associated with porta address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bod value on all other resets 05h porta ? ? ra5 ra4 ra3 ra2 ra1 ra0 --xx xxxx --uu uuuu 0bh/8bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 0000 000u 19h cmcon ? cout ? cinv cis cm2 cm1 cm0 -0-0 0000 -0-0 0000 81h option_reg rapu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 1111 1111 85h trisa ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 --11 1111 --11 1111 91h ansel (1) ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 1111 1111 1111 1111 95h wpua ? ? wpua5 wpua4 ? wpua2 wpua1 wpua0 --11 -111 --11 -111 96h ioca ? ? ioca5 ioca4 ioca3 ioca2 ioca1 ioca0 --00 0000 --00 0000 note 1: pic16f676 only. legend: x = unknown, u = unchanged, - = unimplemented locations read as '0 '. shaded cells are not used by porta.
PIC16F630/676 ds40039d-page 26 ? 2006 microchip technology inc. 3.3 portc portc is a general purpose i/o port consisting of 6 bi- directional pins. the pins can be configured for either digital i/o or analog input to a/d converter. for specific information about individual functions such as the comparator or the a/d, refer to the appropriate section in this data sheet. example 3-2: initializing portc 3.3.1 rc0/an4, rc1/an5, rc2/an6, rc3/ an7 the rc0/rc1/rc2/rc3 pins are configurable to function as one of the following: ? a general purpose i/o ? an analog input for the a/d converter (pic16f676 only) figure 3-6: block diagram of rc0/rc1/rc2/rc3 pins 3.3.2 rc4 and rc5 the rc4 and rc5 pins are configurable to function as a general purpose i/os. figure 3-7: block diagram of rc4 and rc5 pins note: the ansel register (91h) must be clear to configure an analog channel as a digital input. pins configured as analog inputs will read ?0?. the ansel register is defined for the pic16f676. bcf status,rp0 ;bank 0 clrf portc ;init portc bsf status,rp0 ;bank 1 clrf ansel ;digital i/o movlw 0ch ;set rc<3:2> as inputs movwf trisc ;and set rc<5:4,1:0> ;as outputs bcf status,rp0 ;bank 0 i/o pin v dd v ss d q ck q d q ck q data bus wr portc wr trisc rd trisc to a/d converter rd portc analog input mode i/o pin v dd v ss d q ck q d q ck q data bus wr portc wr trisc rd trisc rd portc
? 2006 microchip technology inc. ds40039d-page 27 PIC16F630/676 register 3-5: portc ? portc register (address: 07h) register 3-6: trisc ? portc tristate register (address: 87h) table 3-2: summary of registers associated with portc u-0 u-0 r/w-x r/w-x r/w-x r/w-x r/w-x r/w-x ? ? rc5 rc4 rc3 rc2 rc1 rc0 bit 7 bit 0 bit 7-6: unimplemented : read as ?0? bit 5-0: portc<5:0> : general purpose i/o pin 1 = port pin is >v ih 0 = port pin is : portc tri-state control bit 1 = portc pin configured as an input (tri-stated) 0 = portc pin configured as an output legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bod value on all other resets 07h portc ? ? rc5 rc4 rc3 rc2 rc1 rc0 --xx xxxx --uu uuuu 87h trisc ? ? trisc5 trisc4 trisc3 t risc2 trisc1 trisc0 --11 1111 --11 1111 91h ansel (1) ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 1111 1111 1111 1111 note 1: pic16f676 only. legend: x = unknow n, u = unchanged, - = unimplemented locations read as '0'. shaded cells are not used by portc.
PIC16F630/676 ds40039d-page 28 ? 2006 microchip technology inc. notes:
? 2006 microchip technology inc. ds40039d-page 29 PIC16F630/676 4.0 timer0 module the timer0 module timer/counter has the following features: ? 8-bit timer/counter ? readable and writable ? 8-bit software programmable prescaler ? internal or external clock select ? interrupt on overflow from ffh to 00h ? edge select for external clock figure 4-1 is a block diagram of the timer0 module and the prescaler shared with the wdt. 4.1 timer0 operation timer mode is selected by clearing the t0cs bit (option_reg<5>). in timer mode, the timer0 module will increment every instruction cycle (without prescaler). if tmr0 is written, the increment is inhibited for the following two instruction cycles. the user can work around this by writing an adjusted value to the tmr0 register. counter mode is selected by setting the t0cs bit (option_reg<5>). in this mode, the timer0 module will increment either on every rising or falling edge of pin ra2/t0cki. the incrementing edge is determined by the source edge (t0se) control bit (option_reg<4>). clearing the t0se bit selects the rising edge. 4.2 timer0 interrupt a timer0 interrupt is generated when the tmr0 register timer/counter overflows from ffh to 00h. this overflow sets the t0if bit. the interrupt can be masked by clearing the t0ie bit (intcon<5>). the t0if bit (intcon<2>) must be cleared in software by the timer0 module interrupt service routine before re- enabling this interrupt. the timer0 interrupt cannot wake the processor from sleep since the timer is shut-off during sleep. figure 4-1: block diagram of the timer0/wdt prescaler note: additional information on the timer0 module is available in the pic ? mid-range reference manual, (ds33023). note: counter mode has specific external clock requirements. additional information on these requirements is available in the pic ? mid-range reference manual, (ds33023). t0cki t0se pin clkout tmr0 watchdog timer wdt time-out ps0 - ps2 wdte data bus set flag bit t0if on overflow t0cs note 1: t0se, t0cs, psa, ps0-ps2 are bits in the option register. 0 1 0 1 0 1 sync 2 cycles 8 8 8-bit prescaler 0 1 (= f osc /4) psa psa psa
PIC16F630/676 ds40039d-page 30 ? 2006 microchip technology inc. 4.3 using timer0 with an external clock when no prescaler is used, the external clock input is the same as the prescaler output. the synchronization of t0cki, with the internal phase clocks, is accom- plished by sampling the prescaler output on the q2 and q4 cycles of the internal phase clocks. therefore, it is necessary for t0cki to be high for at least 2t osc (and a small rc delay of 20 ns) and low for at least 2t osc (and a small rc delay of 20 ns). refer to the electrical specification of the desired device. register 4-1: option_reg ? option register (address: 81h) note: the ansel (91h) and cmcon (19h) registers must be initialized to configure an analog channel as a digital input. pins configured as analog inputs will read ?0?. the ansel register is defined for the pic16f676. r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ra pu intedg t0cs t0se psa ps2 ps1 ps0 bit 7 bit 0 bit 7 rapu : porta pull-up enable bit 1 = porta pull-ups are disabled 0 = porta pull-ups are enabled by individual port latch values bit 6 intedg: interrupt edge select bit 1 = interrupt on rising edge of ra2/int pin 0 = interrupt on falling edge of ra2/int pin bit 5 t0cs: tmr0 clock source select bit 1 = transition on ra2/t0cki pin 0 = internal instruction cycle clock (clkout) bit 4 t0se: tmr0 source edge select bit 1 = increment on high-to-low transition on ra2/t0cki pin 0 = increment on low-to-high transition on ra2/t0cki pin bit 3 psa: prescaler assignment bit 1 = prescaler is assigned to the wdt 0 = prescaler is assigned to the timer0 module bit 2-0 ps2:ps0: prescaler rate select bits legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown 000 001 010 011 100 101 110 111 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 1 : 256 1 : 1 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 bit value tmr0 rate wdt rate
? 2006 microchip technology inc. ds40039d-page 31 PIC16F630/676 4.4 prescaler an 8-bit counter is available as a prescaler for the timer0 module, or as a postscaler for the watchdog timer. for simplicity, this counter will be referred to as ?prescaler? throughout this data sheet. the prescaler assignment is controlled in software by the control bit psa (option_reg<3>). clearing the psa bit will assign the prescaler to timer0. prescale values are selectable via the ps2:ps0 bits (option_reg<2:0>). the prescaler is not readable or writable. when assigned to the timer0 module, all instructions writing to the tmr0 register (e.g., clrf 1, movwf 1, bsf 1, x....etc. ) will clear the prescaler. when assigned to wdt, a clrwdt instruction will clear the prescaler along with the watchdog timer. 4.4.1 switching prescaler assignment the prescaler assignment is fully under software control (i.e., it can be changed ?on the fly? during program execution). to avoid an unintended device reset, the following instruction sequence (example 4-1) must be executed when changing the prescaler assignment from timer0 to wdt. example 4-1: changing prescaler (timer0 wdt) to change prescaler from the wdt to the tmr0 module, use the sequence shown in example 4-2. this precaution must be taken even if the wdt is disabled. example 4-2: changing prescaler (wdt timer0) table 4-1: registers associated with timer0 bcf status,rp0 ;bank 0 clrwdt ;clear wdt clrf tmr0 ;clear tmr0 and ; prescaler bsf status,rp0 ;bank 1 movlw b?00101111? ;required if desired movwf option_reg ; ps2:ps0 is clrwdt ; 000 or 001 ; movlw b?00101xxx? ;set postscaler to movwf option_reg ; desired wdt rate bcf status,rp0 ;bank 0 clrwdt ;clear wdt and ; postscaler bsf status,rp0 ;bank 1 movlw b?xxxx0xxx? ;select tmr0, ; prescale, and ; clock source movwf option_reg ; bcf status,rp0 ;bank 0 address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bod value on all other resets 01h tmr0 timer0 module register xxxx xxxx uuuu uuuu 0bh/8bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 0000 000u 81h option_reg rapu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 1111 1111 85h trisa ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 --11 1111 --11 1111 legend: ? = unimplemented locations, read as ?0?, u = unchanged, x = unknown. shaded cells are not used by the timer0 module.
PIC16F630/676 ds40039d-page 32 ? 2006 microchip technology inc. 5.0 timer1 module with gate control the PIC16F630/676 devices have a 16-bit timer. figure 5-1 shows the basic block diagram of the timer1 module. timer1 has the following features: ? 16-bit timer/counter (tmr1h:tmr1l) ? readable and writable ? internal or external clock selection ? synchronous or asynchronous operation ? interrupt on overflow from ffffh to 0000h ? wake-up upon overflow (asynchronous mode) ? optional external enable input (t1g ) ? optional lp oscillator the timer1 control register (t1con), shown in register 5-1, is used to enable/disable timer1 and select the various features of the timer1 module. figure 5-1: timer1 block diagram note: additional information on timer modules is available in the pic ? mid-range refer- ence manual, (ds33023). tmr1h tmr1l lp oscillator t1sync tmr1cs t1ckps<1:0> sleep input f osc /4 internal clock prescaler 1, 2, 4, 8 synchronize detect 1 0 0 1 synchronized clock input 2 osc1 osc2 set flag bit tmr1if on overflow tmr1 tmr1on tmr1ge tmr1on tmr1ge intosc t1oscen lp w/o clkout t1g
? 2006 microchip technology inc. ds40039d-page 33 PIC16F630/676 5.1 timer1 modes of operation timer1 can operate in one of three modes: ? 16-bit timer with prescaler ? 16-bit synchronous counter ? 16-bit asynchronous counter in timer mode, timer1 is incremented on every instruc- tion cycle. in counter mode, timer1 is incremented on the rising edge of the external clock input t1cki. in addition, the counter mode clock can be synchronized to the microcontroller system clock or run asynchronously. in counter and timer modules, the counter/timer clock can be gated by the t1g input. if an external clock oscillator is needed (and the microcontroller is using the intosc w/o clkout), timer1 can use the lp oscillator as a clock source. 5.2 timer1 interrupt the timer1 register pair (tmr1h:tmr1l) increments to ffffh and rolls over to 0000h. when timer1 rolls over, the timer1 interrupt flag bit (pir1<0>) is set. to enable the interrupt on rollover, you must set these bits: ? timer1 interrupt enable bit (pie1<0>) ? peie bit (intcon<6>) ? gie bit (intcon<7>). the interrupt is cleared by clearing the tmr1if in the interrupt service routine. 5.3 timer1 prescaler timer1 has four prescaler options allowing 1, 2, 4, or 8 divisions of the clock input. the t1ckps bits (t1con<5:4>) control the prescale counter. the prescale counter is not directly readable or writable; however, the prescaler counter is cleared upon a write to tmr1h or tmr1l. figure 5-2: timer1 incrementing edge note: in counter mode, a falling edge must be registered by the counter prior to the first incrementing rising edge. note: the tmr1h:ttmr1l register pair and the tmr1if bit should be cleared before enabling interrupts. t1cki = 1 when tmr1 enabled t1cki = 0 when tmr1 enabled note 1: arrows indicate counter increments. 2: in counter mode, a falling edge must be registered by the counter prior to the first incrementing rising edge of the clock.
PIC16F630/676 ds40039d-page 34 ? 2006 microchip technology inc. register 5-1: t1con ? timer1 control regi ster (address: 10h) u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? tmr1ge t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on bit 7 bit 0 bit 7 unimplemented: read as ?0? bit 6 tmr1ge: timer1 gate enable bit if tmr1on = 0: this bit is ignored if tmr1on = 1: 1 = timer1 is on if t1g pin is low 0 = timer1 is on bit 5-4 t1ckps1:t1ckps0: timer1 input clock prescale select bits 11 = 1:8 prescale value 10 = 1:4 prescale value 01 = 1:2 prescale value 00 = 1:1 prescale value bit 3 t1oscen: lp oscillator enable control bit if intosc without clkout oscillator is active: 1 = lp oscillator is enabled for timer1 clock 0 = lp oscillator is off else: this bit is ignored bit 2 t1sync : timer1 external clock input synchronization control bit tmr1cs = 1: 1 = do not synchronize external clock input 0 = synchronize external clock input tmr1cs = 0: this bit is ignored. timer1 uses the internal clock. bit 1 tmr1cs: timer1 clock source select bit 1 = external clock from t1oso/t1cki pin (on the rising edge) 0 = internal clock (f osc /4) bit 0 tmr1on: timer1 on bit 1 = enables timer1 0 = stops timer1 legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
? 2006 microchip technology inc. ds40039d-page 35 PIC16F630/676 5.4 timer1 operation in asynchronous counter mode if control bit t1sync (t1con<2>) is set, the external clock input is not synchronized. the timer continues to increment asynchronous to the internal phase clocks. the timer will continue to run during sleep and can generate an interrupt on overflow, which will wake-up the processor. however, special precautions in software are needed to read/write the timer (section 5.4.1). 5.4.1 reading and writing timer1 in asynchronous counter mode reading tmr1h or tmr1l, while the timer is running from an external asynchronous clock, will ensure a valid read (taken care of in hardware). however, the user should keep in mind that reading the 16-bit timer in two 8-bit values itself, poses certain problems, since the timer may overflow between the reads. for writes, it is recommended that the user simply stop the timer and write the desired values. a write conten- tion may occur by writing to the timer registers, while the register is incrementing. this may produce an unpredictable value in the timer register. reading the 16-bit value requires some care. examples 12-2 and 12-3 in the pic ? mid-range mcu family reference manual (ds33023) show how to read and write timer1 when it is running in asynchronous mode. 5.5 timer1 oscillator a crystal oscillator circuit is built-in between pins osc1 (input) and osc2 (amplifier output). it is enabled by setting control bit t1oscen (t1con<3>). the oscilla- tor is a low power oscillator rated up to 32 khz. it will continue to run during sleep. it is primarily intended for a 32 khz crystal. table 9-2 shows the capacitor selection for the timer1 oscillator. the timer1 oscillator is shared with the system lp oscillator. thus, timer1 can use this mode only when the system clock is derived from the internal oscillator. as with the system lp oscillator, the user must provide a software time delay to ensure proper oscillator start-up. trisa5 and trisa4 bits are set when the timer1 oscillator is enabled. ra5 and ra4 read as ?0? and trisa5 and trisa4 bits read as ?1?. 5.6 timer1 operation during sleep timer1 can only operate during sleep when setup in asynchronous counter mode. in this mode, an external crystal or clock source can be used to increment the counter. to setup the timer to wake the device: ? timer1 must be on (t1con<0>) ? tmr1ie bit (pie1<0>) must be set ? peie bit (intcon<6>) must be set the device will wake-up on an overflow. if the gie bit (intcon<7>) is set, the device will wake-up and jump to the interrupt service routine on an overflow. table 5-1: registers associated with timer1 as a timer/counter note: the ansel (91h) and cmcon (19h) registers must be initialized to configure an analog channel as a digital input. pins configured as analog inputs will read ?0?. the ansel register is defined for the pic16f676. note: the oscillator requires a start-up and stabilization time before use. thus, t1oscen should be set and a suitable delay observed prior to enabling timer1. address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bod value on all other resets 0bh/8bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 0000 000u 0ch pir1 eeif adif ? ? cmif ? ?tmr1if 00-- 0--0 00-- 0--0 0eh tmr1l holding register for the least significant byte of the 16-bit tmr1 register xxxx xxxx uuuu uuuu 0fh tmr1h holding register for the most significant byte of the 16-bit tmr1 register xxxx xxxx uuuu uuuu 10h t1con ? tmr1ge t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on -000 0000 -uuu uuuu 8ch pie1 eeie adie ? ? cmie ? ?tmr1ie 00-- 0--0 00-- 0--0 legend: x = unknown, u = unchanged, - = unimplemented, read as '0'. shaded cell s are not used by the timer1 module.
PIC16F630/676 ds40039d-page 36 ? 2006 microchip technology inc. notes:
? 2006 microchip technology inc. ds40039d-page 37 PIC16F630/676 6.0 comparator module the PIC16F630/676 devices have one analog compar- ator. the inputs to the comparator are multiplexed with the ra0 and ra1 pins. there is an on-chip comparator voltage reference that can also be applied to an input of the comparator. in addition, ra2 can be configured as the comparator output. the comparator control register (cmcon), shown in register 6-1, contains the bits to control the comparator. register 6-1: cmcon ? comparator control register (address: 19h) u-0 r-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ?cout ? cinv cis cm2 cm1 cm0 bit 7 bit 0 bit 7 unimplemented : read as ?0? bit 6 cout : comparator output bit when c i nv = 0: 1 = v in + > v in - 0 = v in + < v in - when c i nv = 1: 1 = v in + < v in - 0 = v in + > v in - bit 5 unimplemented : read as ?0? bit 4 cinv : comparator output inversion bit 1 = output inverted 0 = output not inverted bit 3 cis : comparator input switch bit when cm2:cm0 = 110 or 101: 1 = v in - connects to cin+ 0 = v in - connects to cin- bit 2-0 cm2:cm0 : comparator mode bits figure 6-2 shows the comparator modes and cm2:cm0 bit settings legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
PIC16F630/676 ds40039d-page 38 ? 2006 microchip technology inc. 6.1 comparator operation a single comparator is shown in figure 6-1, along with the relationship between the analog input levels and the digital output. when the analog input at v in + is less than the analog input v in -, the output of the comparator is a digital low level. when the analog input at v in + is greater than the analog input v in -, the output of the comparator is a digital high level. the shaded areas of the output of the comparator in figure 6-1 represent the uncertainty due to input offsets and response time. the polarity of the comparator output can be inverted by setting the cinv bit (cmcon<4>). clearing cinv results in a non-inverted output. a complete table showing the output state versus input conditions and the polarity bit is shown in table 6-1. table 6-1: output state vs. input conditions figure 6-1: single comparator note: to use cin+ and cin- pins as analog inputs, the appropriate bits must be programmed in the cmcon (19h) register. input conditions cinv cout v in - > v in + 00 v in - < v in + 01 v in - > v in + 11 v in - < v in + 10 output v in - v in + output + ? v in + v in - note: cinv bit (cmcon<4>) is clear.
? 2006 microchip technology inc. ds40039d-page 39 PIC16F630/676 6.2 comparator configuration there are eight modes of operation for the comparator. the cmcon register, shown in register 6-1, is used to select the mode. figure 6-2 shows the eight possible modes. the trisa register controls the data direction of the comparator pins for each mode. if the comparator mode is changed, the comparator output level may not be valid for a specified period of time. refer to the specifications in section 12.0. figure 6-2: comparator i/o operating modes note: comparator interrupts should be disabled during a comparator mode change. other- wise, a false interrupt may occur. comparator reset (por default value - low power) comparator off (lowest power) cm2:cm0 = 000 cm2:cm0 = 111 comparator without output comparator w/o output and with internal reference cm2:cm0 = 010 cm2:cm0 = 100 comparator with output and internal reference mul tiplexed input with internal reference and output cm2:cm0 = 011 cm2:cm0 = 101 comparator with output multiplexed input with internal reference cm2:cm0 = 001 cm2:cm0 = 110 a = analog input, ports always reads ?0? d = digital input cis = comparator input switch (cmcon<3>) ra1/cin- ra0/cin+ off (read as '0') a a ra2/cout d ra1/cin- ra0/cin+ off (read as '0') d d ra2/cout d ra1/cin- ra0/cin+ cout a a ra2/cout d ra1/cin- ra0/cin+ cout a d ra2/cout d from cv ref module ra1/cin- ra0/cin+ cout a d ra2/cout d from cv ref module ra1/cin- ra0/cin+ cout a a ra2/cout d from cv ref module cis = 0 cis = 1 ra1/cin- ra0/cin+ cout a a ra2/cout d ra1/cin- ra0/cin+ cout a a ra2/cout d from cv ref module cis = 0 cis = 1
PIC16F630/676 ds40039d-page 40 ? 2006 microchip technology inc. 6.3 analog input connection considerations a simplified circuit for an analog input is shown in figure 6-3. since the analog pins are connected to a digital output, they have reverse biased diodes to v dd and v ss . the analog input, therefore, must be between v ss and v dd . if the input voltage deviates from this range by more than 0.6v in either direction, one of the diodes is forward biased and a latchup may occur. a maximum source impedance of 10 k is recommended for the analog sources. any external component connected to an analog input pin, such as a capacitor or a zener diode, should have very little leakage current. figure 6-3: analog input mode 6.4 comparator output the comparator output, cout, is read through the cmcon register. this bit is read-only. the comparator output may also be directly output to the ra2 pin in three of the eight possible modes, as shown in figure 6-2. when in one of these modes, the output on ra2 is asynchronous to the internal clock. figure 6-4 shows the comparator output block diagram. the trisa<2> bit functions as an output enable/ disable for the ra2 pin while the comparator is in an output mode. figure 6-4: modified comp arator output block diagram va rs < 10k a in c pin 5 pf v dd v t = 0.6v v t = 0.6v r ic leakage 500 na vss legend: c pin = input capacitance v t = threshold voltage i leakage = leakage current at the pin due to various junctions r ic = interconnect resistance r s = source impedance va = analog voltage note 1: when reading the porta register, all pins configured as analog inputs will read as a ?0?. pins configured as digital inputs will convert an analog input according to the ttl input specification. 2: analog levels on any pin that is defined as a digital input, may cause the input buffer to consume more current than is specified. to ra2/t0cki pin rd cmcon set cmif bit reset to d a ta b u s cinv cv ref d en q d en q rd cmcon ra1/cin- ra0/cin+ cm2:cm0
? 2006 microchip technology inc. ds40039d-page 41 PIC16F630/676 6.5 comparator reference the comparator module also allows the selection of an internally generated voltage reference for one of the comparator inputs. the internal reference signal is used for four of the eight comparator modes. the vrcon register, register 6-2, controls the voltage reference module shown in figure 6-5. 6.5.1 configuring the voltage reference the voltage reference can output 32 distinct voltage levels, 16 in a high range and 16 in a low range. the following equations determine the output voltages: vrr = 1 (low range): cv ref = (vr3:vr0 / 24) x v dd vrr = 0 (high range): cv ref = (v dd / 4) + (vr3:vr0 x v dd / 32) 6.5.2 voltage reference accuracy/error the full range of v ss to v dd cannot be realized due to the construction of the module. the transistors on the top and bottom of the resistor ladder network (figure 6-5) keep cv ref from approaching v ss or v dd . the voltage reference is v dd derived and there- fore, the cv ref output changes with fluctuations in v dd . the tested absolute accuracy of the comparator voltage reference can be found in section 12.0. figure 6-5: comparator voltage reference block diagram 6.6 comparator response time response time is the minimum time, after selecting a new reference voltage or input source, before the comparator output is ensured to have a valid level. if the internal reference is changed, the maximum delay of the internal voltage reference must be considered when using the comparator outputs. otherwise, the maximum delay of the comparators should be used (table 12-7). 6.7 operation during sleep both the comparator and voltage reference, if enabled before entering sleep mode, remain active during sleep. this results in higher sleep currents than shown in the power-down specifications. the additional current consumed by the comparator and the voltage reference is shown separately in the specifica- tions. to minimize power consumption while in sleep mode, turn off the comparator, cm2:cm0 = 111 , and voltage reference, vrcon<7> = 0. while the comparator is enabled during sleep, an interrupt will wake-up the device. if the device wakes up from sleep, the contents of the cmcon and vrcon registers are not affected. 6.8 effects of a reset a device reset forces the cmcon and vrcon registers to their reset states. this forces the comparator module to be in the comparator reset mode, cm2:cm0 = 000 and the voltage reference to its off state. thus, all potential inputs are analog inputs with the comparator and voltage reference disabled to consume the smallest current possible. vrr 8r vr3:vr0 16-1 analog 8rrr rr cv ref to 16 stages comparator input vren v dd mux
PIC16F630/676 ds40039d-page 42 ? 2006 microchip technology inc. register 6-2: vrcon ? voltage reference control register (address: 99h) 6.9 comparator interrupts the comparator interrupt flag is set whenever there is a change in the output value of the comparator. software will need to maintain information about the status of the output bits, as read from cmcon<6>, to determine the actual change that has occurred. the cmif bit, pir1<3>, is the comparator interrupt flag. this bit must be reset in software by clearing it to ?0?. since it is also possible to write a '1' to this register, a simulated interrupt may be initiated. the cmie bit (pie1<3>) and the peie bit (intcon<6>) must be set to enable the interrupt. in addition, the gie bit must also be set. if any of these bits are cleared, the interrupt is not enabled, though the cmif bit will still be set if an interrupt condition occurs. the user, in the interrupt service routine, can clear the interrupt in the following manner: a) any read or write of cmcon. this will end the mismatch condition. b) clear flag bit cmif. a mismatch condition will continue to set flag bit cmif. reading cmcon will end the mismatch condition and allow flag bit cmif to be cleared. table 6-2: registers associated with comparator module r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 vren ?vrr ? vr3 vr2 vr1 vr0 bit 7 bit 0 bit 7 vren: cv ref enable bit 1 = cv ref circuit powered on 0 = cv ref circuit powered down, no i dd drain bit 6 unimplemented: read as '0' bit 5 vrr: cv ref range selection bit 1 = low range 0 = high range bit 4 unimplemented: read as '0' bit 3-0 vr3:vr0: cv ref value selection 0 vr [3:0] 15 when vrr = 1: cv ref = (vr3:vr0 / 24) * v dd when vrr = 0: cv ref = v dd /4 + (vr3:vr0 / 32) * v dd legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown note: if a change in the cmcon register (cout) should occur when a read operation is being executed (start of the q2 cycle), then the cmif (pir1<3>) interrupt flag may not get set. address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bod value on all other resets 0bh/8bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 0000 000u 0ch pir1 eeif adif ? ?cmif ? ? tmr1if 00-- 0--0 00-- 0--0 19h cmcon ?cout ? cinv cis cm2 cm1 cm0 -0-0 0000 -0-0 0000 8ch pie1 eeie adie ? ?cmie ? ? tmr1ie 00-- 0--0 00-- 0--0 85h trisa ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 --11 1111 --11 1111 99h vrcon vren ?vrr ? vr3 vr2 vr1 vr0 0-0- 0000 0-0- 0000 legend: x = unknown, u = unchanged, ? = unimplem ented, read as ?0?. shaded cells are not used by the comparator module.
? 2006 microchip technology inc. ds40039d-page 43 PIC16F630/676 7.0 analog-to-digital converter (a/d) module (pic16f676 only) the analog-to-digital converter (a/d) allows conversion of an analog input signal to a 10-bit binary representa- tion of that signal. the pic16f676 has eight analog inputs, multiplexed into one sample and hold circuit. the output of the sample and hold is connected to the input of the converter. the converter generates a binary result via successive approximation and stores the result in a 10-bit register. the voltage reference used in the conversion is software selectable to either v dd or a voltage applied by the v ref pin. figure 7-1 shows the block diagram of the a/d on the pic16f676. figure 7-1: a/d block diagram 7.1 a/d configuration and operation there are three registers available to control the functionality of the a/d module: 1. adcon0 (register 7-1) 2. adcon1 (register 7-2) 3. ansel (register 7-3) 7.1.1 analog port pins the ans7:ans0 bits (ansel<7:0>) and the trisa bits control the operation of the a/d port pins. set the corresponding trisa bits to set the pin output driver to its high impedance state. likewise, set the correspond- ing ans bit to disable the digital input buffer. 7.1.2 channel selection there are eight analog channels on the pic16f676, an0 through an7. the chs2:chs0 bits (adcon0<4:2>) control which channel is connected to the sample and hold circuit. 7.1.3 voltage reference there are two options for the voltage reference to the a/d converter: either v dd is used, or an analog voltage applied to v ref is used. the vcfg bit (adcon0<6>) controls the voltage reference selection. if vcfg is set, then the voltage on the v ref pin is the reference; otherwise, v dd is the reference. 7.1.4 conversion clock the a/d conversion cycle requires 11 t ad . the source of the conversion clock is software selectable via the adcs bits (adcon1<6:4>). there are seven possible clock options: ?f osc /2 ?f osc /4 ?f osc /8 ?f osc /16 ?f osc /32 ?f osc /64 ?f rc (dedicated internal oscillator) for correct conversion, the a/d conversion clock (1/t ad ) must be selected to ensure a minimum t ad of 1.6 s. table 7-1 shows a few t ad calculations for selected frequencies. ra0/an0 adc ra1/an1/v ref ra2/an2 rc0/an4 v dd v ref adon go/done vcfg = 1 vcfg = 0 chs2:chs0 adresh adresl 10 10 adfm v ss rc1/an5 rc2/an6 rc3/an7 ra4/an3 note: analog voltages on any pin that is defined as a digital input may cause the input buffer to conduct excess current.
PIC16F630/676 ds40039d-page 44 ? 2006 microchip technology inc. table 7-1: t ad vs. device operating frequencies 7.1.5 starting a conversion the a/d conversion is initiated by setting the go/done bit (adcon0<1>). when the conversion is complete, the a/d module: ? clears the go/done bit ? sets the adif flag (pir1<6>) ? generates an interrupt (if enabled) if the conversion must be aborted, the go/done bit can be cleared in software. the adresh:adresl registers will not be updated with the partially complete a/d conversion sample. instead, the adresh:adresl registers will retain the value of the previous conversion. after an aborted conversion, a 2t ad delay is required before another acquisition can be initiated. following the delay, an input acquisition is automatically started on the selected channel. 7.1.6 conversion output the a/d conversion can be supplied in two formats: left or right shifted. the adfm bit (adcon0<7>) controls the output format. figure 7-2 shows the output formats. figure 7-2: 10-bit a/d result format a/d clock source (t ad ) device frequency operation adcs2:adcs0 20 mhz 5 mhz 4 mhz 1.25 mhz 2 t osc 000 100 ns (2) 400 ns (2) 500 ns (2) 1.6 s 4 t osc 100 200 ns (2) 800 ns (2) 1.0 s (2) 3.2 s 8 t osc 001 400 ns (2) 1.6 s2.0 s6.4 s 16 t osc 101 800 ns (2) 3.2 s4.0 s 12.8 s (3) 32 t osc 010 1.6 s6.4 s 8.0 s (3) 25.6 s (3) 64 t osc 110 3.2 s 12.8 s (3) 16.0 s (3) 51.2 s (3) a/d rc x11 2 - 6 s (1,4) 2 - 6 s (1,4) 2 - 6 s (1,4) 2 - 6 s (1,4) legend: shaded cells are outside of recommended range. note 1: the a/d rc source has a typical t ad time of 4 s for v dd > 3.0v. 2: these values violate the minimum required t ad time. 3: for faster conversion times, the selection of another clock source is recommended. 4: when the device frequency is greater than 1 mhz, the a/d rc clock source is only recommended if the conversion will be performed during sleep. note: the go/done bit should not be set in the same instruction that turns on the a/d. adresh adresl (adfm = 0) msb lsb bit 7bit 0bit 7bit 0 10-bit a/d result unimplemented: read as ?0? (adfm = 1) msb lsb bit 7bit 0bit 7bit 0 unimplemented: read as ?0 10-bit a/d result
? 2006 microchip technology inc. ds40039d-page 45 PIC16F630/676 register 7-1: adcon0 ? a/d control register (address: 1fh) register 7-2: adcon1 ? a/d control register 1 (adress: 9fh) r/w-0 r/w-0 u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 adfm vcfg ? chs2 chs1 chs0 go/done adon bit 7 bit 0 bit 7 adfm: a/d result formed select bit 1 = right justified 0 = left justified bit 6 vcfg: voltage reference bit 1 = v ref pin 0 = v dd bit 5 unimplemented: read as zero bit 4-2 chs2:chs0: analog channel select bits 000 =channel 00 (an0) 001 =channel 01 (an1) 010 =channel 02 (an2) 011 =channel 03 (an3) 100 =channel 04 (an4) 101 =channel 05 (an5) 110 =channel 06 (an6) 111 =channel 07 (an7) bit 1 go/done : a/d conversion status bit 1 = a/d conversion cycle in progress. setting this bit starts an a/d conversion cycle. this bit is automatically cleared by hardware when the a/d conversion has completed. 0 = a/d conversion completed/not in progress bit 0 adon: a/d conversion status bit 1 = a/d converter module is operating 0 = a/d converter is shut-off and consumes no operating current legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown u-0 r/w-0 r/w-0 r/w-0 u-0 u-0 u-0 u-0 ? adcs2 adcs1 adcs0 ? ? ? ? bit 7 bit 0 bit 7: unimplemented: read as ?0?. bit 6-4: adcs<2:0>: a/d conversion clock select bits 000 =f osc /2 001 =f osc /8 010 =f osc /32 x11 =f rc (clock derived from a dedicated internal oscillator = 500 khz max) 100 =f osc /4 101 =f osc /16 110 =f osc /64 bit 3-0: unimplemented: read as ?0?. legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
PIC16F630/676 ds40039d-page 46 ? 2006 microchip technology inc. register 7-3: ansel ? analog select register (adress: 91h) (pic16f676 only) r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 r/w-1 ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 bit 7 bit 0 bit 7-0: ans<7:0> : analog select between analog or digital function on pins an<7:0>, respectively. 1 = analog input. pin is assigned as analog input. (1) 0 = digital i/o. pin is assigned to port or special function. note 1: setting a pin to an analog input automatically disables the digital input circuitry, weak pull-ups, and interrupt-on-change if available. the corresponding tris bit must be set to input mode in order to allow external control of the voltage on the pin. legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
? 2006 microchip technology inc. ds40039d-page 47 PIC16F630/676 7.2 a/d acquisition requirements for the a/d converter to meet its specified accuracy, the charge holding capacitor (c hold ) must be allowed to fully charge to the input channel voltage level. the analog input model is shown in figure 7-3. the source impedance (r s ) and the internal sampling switch (r ss ) impedance directly affect the time required to charge the capacitor c hold . the sampling switch (r ss ) impedance varies over the device voltage (v dd ), see figure 7-3. the maximum recommended imped- ance for analog sources is 10 k . as the impedance is decreased, the acquisition time may be decreased. after the analog input channel is selected (changed), this acquisition must be done before the conversion can be started. to calculate the minimum acquisition time, equation 7-1 may be used. this equation assumes that 1/2 lsb error is used (1024 steps for the a/d). the 1/2 lsb error is the maximum error allowed for the a/d to meet its specified resolution. to calculate the minimum acquisition time, t acq , see the pic ? mid-range reference manual (ds33023). equation 7-1: acquisition time figure 7-3: analog input model t acq t c t acq = = = = = = = = amplifier settling time + hold capacitor charging time + temperature coefficient t amp + t c + t coff 2 s + t c + [(temperature -25 c)(0.05 s/c)] c hold (r ic + r ss + r s ) in(1/2047) - 120pf (1k + 7k + 10k ) in(0.0004885) 16.47 s 2 s + 16.47 s + [(50c -25 c)(0.05 s/ c) 19.72 s note 1: the reference voltage (v ref ) has no effect on the equation, since it cancels itself out. 2: the charge holding capacitor (c hold ) is not discharged after each conversion. 3: the maximum recommended impedance for analog sources is 10 k . this is required to meet the pin leakage specification. c pin va r s anx 5 pf v dd v t = 0.6v v t = 0.6v i leakage r ic 1k sampling switch ss r ss c hold = dac capacitance v ss 6v sampling switch 5v 4v 3v 2v 567891011 (k ) v dd = 120 pf 500 na legend: c pin v t i leakage r ic ss c hold = input capacitance = threshold voltage = leakage current at the pin due to = interconnect resistance = sampling switch = sample/hold capacitance (from dac) various junctions
PIC16F630/676 ds40039d-page 48 ? 2006 microchip technology inc. 7.3 a/d operation during sleep the a/d converter module can operate during sleep. this requires the a/d clock source to be set to the internal oscillator. when the rc clock source is selected, the a/d waits one instruction before starting the conversion. this allows the sleep instruction to be executed, thus eliminating much of the switching noise from the conversion. when the conversion is complete, the go/done bit is cleared, and the result is loaded into the adresh:adresl registers. if the a/d interrupt is enabled, the device awakens from sleep. if the a/d interrupt is not enabled, the a/d module is turned off, although the adon bit remains set. when the a/d clock source is something other than rc, a sleep instruction causes the present conversion to be aborted, and the a/d module is turned off. the adon bit remains set. 7.4 effects of reset a device reset forces all registers to their reset state. thus, the a/d module is turned off and any pending conversion is aborted. the adresh:adresl registers are unchanged. table 7-2: summary of a/d registers address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on: por, bod value on all other resets 05h porta ? ? porta5 porta4 porta3 porta2 porta1 porta0 --xx xxxx --uu uuuu 07h portc ? ? portc5 portc4 portc3 portc2 portc1 portc0 --xx xxxx --uu uuuu 0bh, 8bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 0000 000u 0ch pir1 eeif adif ? ? cmif ? ? tmr1if 00-- 0--0 00-- 0--0 1eh adresh most significant 8 bits of the left shifted a/d result or 2 bits of the right shifted result xxxx xxxx uuuu uuuu 1fh adcon0 adfm vcfg ? chs2 chs1 chs0 go adon 00-0 0000 00-0 0000 85h trisa ? ? trisa5 trisa4 trisa3 trisa2 trisa1 trisa0 --11 1111 --11 1111 87h trisc ? ? trisc5 trisc4 trisc3 trisc2 trisc1 trisc0 --11 1111 --11 1111 8ch pie1 eeie adie ? ? cmie ? ? tmr1ie 00-- 0--0 00-- 0--0 91h ansel ans7 ans6 ans5 ans4 ans3 ans2 ans1 ans0 1111 1111 1111 1111 9eh adresl least significant 2 bits of the left shifted a/d result or 8 bits of the right shifted result xxxx xxxx uuuu uuuu 9fh adcon1 ? adcs2 adcs1 adcs0 ? ? ? ? -000 ---- -000 ---- legend: x = unknown, u = unchanged, - = unimplemented read as '0'. shaded cell s are not used for a/d converter module.
? 2006 microchip technology inc. ds40039d-page 49 PIC16F630/676 8.0 data eeprom memory the eeprom data memory is readable and writable during normal operation (full v dd range). this memory is not directly mapped in the register file space. instead, it is indirectly addressed through the special function registers. there are four sfrs used to read and write this memory: ? eecon1 ? eecon2 (not a physically implemented register) ? eedata ? eeadr eedata holds the 8-bit data for read/write, and eeadr holds the address of the eeprom location being accessed. PIC16F630/676 devices have 128 bytes of data eeprom with an address range from 0h to 7fh. the eeprom data memory allows byte read and write. a byte write automatically erases the location and writes the new data (erase before write). the eeprom data memory is rated for high erase/write cycles. the write time is controlled by an on-chip timer. the write time will vary with voltage and temperature as well as from chip to chip. please refer to ac specifications for exact limits. when the data memory is code protected, the cpu may continue to read and write the data eeprom memory. the device programmer can no longer access this memory. additional information on the data eeprom is available in the pic ? mid-range reference manual, (ds33023). register 8-1: eedat ? eeprom data register (address: 9ah) register 8-2: eeadr ? eeprom address register (address: 9bh) r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 eedat7 eedat6 eedat5 eedat4 eedat3 eedat2 eedat1 eedat0 bit 7 bit 0 bit 7-0 eedatn : byte value to write to or read from data eeprom legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown u-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 r/w-0 ? eadr6 eadr5 eadr4 eadr3 eadr2 eadr1 eadr0 bit 7 bit 0 bit 7 unimplemented : should be set to '0' bit 6-0 eeadr : specifies one of 128 locations for eeprom read/write operation legend: r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
PIC16F630/676 ds40039d-page 50 ? 2006 microchip technology inc. 8.1 eeadr the eeadr register can address up to a maximum of 128 bytes of data eeprom. only seven of the eight bits in the register (eeadr<6:0>) are required. the msb (bit 7) is ignored. the upper bit should always be ?0? to remain upward compatible with devices that have more data eeprom memory. 8.2 eecon1 and eecon2 registers eecon1 is the control register with four low order bits physically implemented. the upper four bits are non- implemented and read as '0's. control bits rd and wr initiate read and write, respectively. these bits cannot be cleared, only set, in software. they are cleared in hardware at completion of the read or write operation. the inability to clear the wr bit in software prevents the accidental, premature termination of a write operation. the wren bit, when set, will allow a write operation. on power-up, the wren bit is clear. the wrerr bit is set when a write operation is interrupted by a mclr reset, or a wdt time-out reset during normal operation. in these situations, following reset, the user can check the wrerr bit, clear it, and rewrite the location. the data and address will be cleared, therefore, the eedata and eeadr registers will need to be re-initialized. interrupt flag bit eeif in the pir1 register is set when write is complete. this bit must be cleared in software. eecon2 is not a physical register. reading eecon2 will read all '0's. the eecon2 register is used exclusively in the data eeprom write sequence. register 8-3: eecon1 ? eeprom control regist er (address: 9ch) u-0 u-0 u-0 u-0 r/w-x r/w-0 r/s-0 r/s-0 ? ? ? ? wrerr wren wr rd bit 7 bit 0 bit 7-4 unimplemented: read as ?0? bit 3 wrerr: eeprom error flag bit 1 = a write operation is prematurely terminated (any mclr reset, any wdt reset during normal operation or bod detect) 0 = the write operation completed bit 2 wren: eeprom write enable bit 1 = allows write cycles 0 = inhibits write to the data eeprom bit 1 wr : write control bit 1 = initiates a write cycle (the bit is cleared by hardware once write is complete. the wr bit can only be set, not cleared, in software.) 0 = write cycle to the data eeprom is complete bit 0 rd : read control bit 1 = initiates an eeprom read (read takes one cycle. rd is cleared in hardware. the rd bit can only be set, not cleared, in software.) 0 = does not initiate an eeprom read legend: s = bit can only be set r = readable bit w = writable bit u = unimplemented bit, read as ?0? - n = value at por ?1? = bit is set ?0? = bit is cleared x = bit is unknown
? 2006 microchip technology inc. ds40039d-page 51 PIC16F630/676 8.3 reading the eeprom data memory to read a data memory location, the user must write the address to the eeadr register and then set control bit rd (eecon1<0>), as shown in example 8-1. the data is available, in the very next cycle, in the eedata register. therefore, it can be read in the next instruction. eedata holds this value until another read, or until it is written to by the user (during a write operation). example 8-1: data eeprom read 8.4 writing to the eeprom data memory to write an eeprom data location, the user must first write the address to the eeadr register and the data to the eedata register. then the user must follow a specific sequence to initiate the write for each byte, as shown in example 8-2. example 8-2: data eeprom write the write will not initiate if the above sequence is not exactly followed (write 55h to eecon2, write aah to eecon2, then set wr bit) for each byte. we strongly recommend that interrupts be disabled during this code segment. a cycle count is executed during the required sequence. any number that is not equal to the required cycles to execute the required sequence will prevent the data from being written into the eeprom. additionally, the wren bit in eecon1 must be set to enable write. this mechanism prevents accidental writes to data eeprom due to errant (unexpected) code execution (i.e., lost programs). the user should keep the wren bit clear at all times, except when updating eeprom. the wren bit is not cleared by hardware. after a write sequence has been initiated, clearing the wren bit will not affect this write cycle. the wr bit will be inhibited from being set unless the wren bit is set. at the completion of the write cycle, the wr bit is cleared in hardware and the ee write complete interrupt flag bit (eeif) is set. the user can either enable this interrupt or poll this bit. the eeif bit (pir<7>) register must be cleared by software. 8.5 write verify depending on the application, good programming practice may dictate that the value written to the data eeprom should be verified (see example 8-3) to the desired value to be written. example 8-3: write verify 8.5.1 using the data eeprom the data eeprom is a high-endurance, byte addres- sable array that has been optimized for the storage of frequently changing information (e.g., program variables or other data that are updated often). frequently changing values will typically be updated more often than specifications d120 or d120a. if this is not the case, an array refresh must be performed. for this reason, variables that change infrequently (such as constants, ids, calibration, etc.) should be stored in flash program memory. 8.6 protection against spurious write there are conditions when the user may not want to write to the data eeprom memory. to protect against spurious eeprom writes, various mechanisms have been built in. on power-up, wren is cleared. also, the power-up timer (72 ms duration) prevents eeprom write. the write initiate sequence and the wren bit together help prevent an accidental write during: ?brown-out ? power glitch ? software malfunction bsf status,rp0 ;bank 1 movlw config_addr ; movwf eeadr ;address to read bsf eecon1,rd ;ee read movf eedata,w ;move data to w bsf status,rp0 ;bank 1 bsf eecon1,wren ;enable write bcf intcon,gie ;disable ints movlw 55h ;unlock write movwf eecon2 ; movlw aah ; movwf eecon2 ; bsf eecon1,wr ;start the write bsf intcon,gie ;enable ints required sequence bcf status,rp0 ;bank 0 : ;any code bsf status,rp0 ;bank 1 read movf eedata,w ;eedata not changed ;from previous write bsf eecon1,rd ;yes, read the ;value written xorwf eedata,w btfss status,z ;is data the same goto write_err ;no, handle error : ;yes, continue
PIC16F630/676 ds40039d-page 52 ? 2006 microchip technology inc. 8.7 data eeprom operation during code protect data memory can be code protected by programming the cpd bit to ?0?. when the data memory is code protected, the cpu is able to read and write data to the data eeprom. it is recommended to code protect the program memory when code protecting data memory. this prevents anyone from programming zeroes over the existing code (which will execute as nop s) to reach an added routine, programmed in unused program memory, which outputs the contents of data memory. programming unused locations to ?0? will also help prevent data memory code protection from becoming breached. table 8-1: registers/bits associated with data eeprom address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bod value on all other resets 0ch pir1 eeif adif ? ? cmif ? ? tmr1if 00-- 0--0 00-- 0--0 9ah eedata eeprom data register 0000 0000 0000 0000 9bh eeadr ? eeprom address register -000 0000 -000 0000 9ch eecon1 ? ? ? ? wrerr wren wr rd ---- x000 ---- q000 9dh eecon2 (1) eeprom control register 2 ---- ---- ---- ---- legend: x = unknown, u = unchanged, ? = unimplemented read as '0', q = value depends upon condition. shaded cells are not used by data eeprom module. note 1: eecon2 is not a physical register.
? 2006 microchip technology inc. ds40039d-page 53 PIC16F630/676 9.0 special features of the cpu certain special circuits that deal with the needs of real time applications are what sets a microcontroller apart from other processors. the PIC16F630/676 family has a host of such features intended to: ? maximize system reliability ? minimize cost through elimination of external components ? provide power saving operating modes and offer code protection these features are: ? oscillator selection ? reset - power-on reset (por) - power-up timer (pwrt) - oscillator start-up timer (ost) - brown-out detect (bod) ? interrupts ? watchdog timer (wdt) ? sleep ? code protection ? id locations ? in-circuit serial programming the PIC16F630/676 has a watchdog timer that is controlled by configuration bits. it runs off its own rc oscillator for added reliability. there are two timers that offer necessary delays on power-up. one is the oscillator start-up timer (ost), intended to keep the chip in reset until the crystal oscillator is stable. the other is the power-up timer (pwrt), which provides a fixed delay of 72 ms (nominal) on power-up only, designed to keep the part in reset while the power supply stabilizes. there is also circuitry to reset the device if a brown-out occurs, which can provide at least a 72 ms reset. with these three functions on-chip, most applications need no external reset circuitry. the sleep mode is designed to offer a very low current power-down mode. the user can wake-up from sleep through: ? external reset ? watchdog timer wake-up ? an interrupt several oscillator options are also made available to allow the part to fit the application. the intosc option saves system cost while the lp crystal option saves power. a set of configuration bits are used to select various options (see register 9-1).
PIC16F630/676 ds40039d-page 54 ? 2006 microchip technology inc. 9.1 configuration bits the configuration bits can be programmed (read as '0'), or left unprogrammed (read as '1') to select various device configurations, as shown in register 9-1. these bits are mapped in program memory location 2007h. register 9-1: config ? co nfiguration word (address: 2007h) note: address 2007h is beyond the user program memory space. it belongs to the special con- figuration memory space (2000h - 3fffh), which can be accessed only during program- ming. see PIC16F630/676 programming specification for more information. r/p-1 r/p-1 u-0 u-0 u-0 r/p-1 r/p-1 r/p-1 r/p-1 r/p-1 r/p-1 r/p-1 r/p-1 r/p-1 bg1 bg0 ? ? ?cpd cp boden mclre pwrte wdte f0sc2 f0sc1 f0sc0 bit 13 bit 0 bit 13-12 bg1:bg0: bandgap calibration bits for bod and por voltage (1) 00 = lowest bandgap voltage 11 = highest bandgap voltage bit 11-9 unimplemented : read as ?0? bit 8 cpd : data code protection bit (2) 1 = data memory code protection is disabled 0 = data memory code protection is enabled bit 7 cp : code protection bit (3) 1 = program memory code protection is disabled 0 = program memory code protection is enabled bit 6 boden : brown-out detect enable bit (4) 1 = bod enabled 0 = bod disabled bit 5 mclre : ra3/mclr pin function select (5) 1 = ra3/mclr pin function is mclr 0 = ra3/mclr pin function is digital i/o, mclr internally tied to v dd bit 4 pwrte : power-up timer enable bit 1 = pwrt disabled 0 = pwrt enabled bit 3 wdte : watchdog timer enable bit 1 = wdt enabled 0 = wdt disabled bit 2-0 fosc2:fosc0 : oscillator selection bits 111 = rc oscillator: clkout function on ra4/osc2/clkout pin, rc on ra5/osc1/clkin 110 = rc oscillator: i/o function on ra4/osc2/clkout pin, rc on ra5/osc1/clkin 101 = intosc oscillator: clkout function on ra4/osc2/clkout pin, i/o function on ra5/osc1/clkin 100 = intosc oscillator: i/o function on ra4/osc2 /clkout pin, i/o function on ra5/osc1/clkin 011 = ec: i/o function on ra4/osc2/clkout pin, clkin on ra5/osc1/clkin 010 = hs oscillator: high speed crystal/resonator on ra4/osc2/clkout and ra5/osc1/clkin 001 = xt oscillator: crystal/resonator on ra4/osc2/clkout and ra5/osc1/clkin 000 = lp oscillator: low power crystal on ra4/osc2/clkout and ra5/osc1/clkin note 1: the bandgap calibration bits are factory progra mmed and must be read and saved prior to erasing the device as specified in the PIC16F630/676 progr amming specification. these bits are reflected in an export of the configuration word. microchip development tools maintain all calibration bits to factory settings. 2: the entire data eeprom will be erased when the code protection is turned off. 3: the entire program memory will be erased, including osccal value, when the code protection is turned off. 4: enabling brown-out detect does not automatically enable power-up timer. 5: when mclr is asserted in intosc or rc mode, the internal clock oscillator is disabled. legend: p = programmed using icsp r = readable bit w = writable bit u = unimplemented bit, read as ?0? -n = value at por 1 = bit is set 0 = bit is cleared x = bit is unknown
? 2006 microchip technology inc. ds40039d-page 55 PIC16F630/676 9.2 oscillator configurations 9.2.1 oscillator types the PIC16F630/676 can be operated in eight different oscillator option modes. the user can program three configuration bits (fosc2 through fosc0) to select one of these eight modes: ? lp low power crystal ? xt crystal/resonator ? hs high speed crystal/resonator ? rc external resistor/capacitor (2 modes) ? intosc internal oscillator (2 modes) ? ec external clock in 9.2.2 crystal oscillator / ceramic resonators in xt, lp or hs modes a crystal or ceramic resonator is connected to the osc1 and osc2 pins to establish oscillation (see figure 9-1). the PIC16F630/676 oscil- lator design requires the use of a parallel cut crystal. use of a series cut crystal may yield a frequency outside of the crystal manufacturers specifications. when in xt, lp or hs modes, the device can have an external clock source to drive the osc1 pin (see figure 9-2). figure 9-1: crystal operation (or ceramic resonator) (hs, xt or lp osc configuration) figure 9-2: external clock input operation (hs, xt, ec, or lp osc configuration) table 9-1: capacitor selection for ceramic resonators table 9-2: capacitor selection for crystal oscillator note: additional information on oscillator config- urations is available in the pic ? mid-range reference manual, (ds33023). note 1: see table 9-1 and table 9-2 for recommended values of c1 and c2. 2: a series resistor may be required for at strip cut crystals. 3: rf varies with the oscillator mode selected (approx. value = 10 m ). c1 (1) c2 (1) xtal osc2 osc1 rf (3) sleep to internal PIC16F630/676 logic rs (2) ranges characterized: mode freq osc1(c1) osc2(c2) xt 455 khz 2.0 mhz 4.0 mhz 68 - 100 pf 15 - 68 pf 15 - 68 pf 68 - 100 pf 15 - 68 pf 15 - 68 pf hs 8.0 mhz 16.0 mhz 10 - 68 pf 10 - 22 pf 10 - 68 pf 10 - 22 pf note 1: higher capacitance increases the stability of the oscillator but also increases the start-up time. these values are for design guidance only. since each resonator has its own characteristics, the user should consult the resonator manufacturer for appropriate values of external components. mode freq osc1(c1) osc2(c2) lp 32 khz 68 - 100 pf 68 - 100 pf xt 100 khz 2 mhz 4 mhz 68 - 150 pf 15 - 30 pf 15 - 30 pf 150 - 200 pf 15 - 30 pf 15 - 30 pf hs 8 mhz 10 mhz 20 mhz 15 - 30 pf 15 - 30 pf 15 - 30 pf 15 - 30 pf 15 - 30 pf 15 - 30 pf note 1: higher capacitance increases the stability of the oscillator but also increases the start-up time. these values are for design guidance only. rs may be required in hs mode as well as xt mode to avoid overdriving crystals with low drive level specification. since each crystal has its own characteristics, the user should consult the crystal manufacturer for appropriate values of external components. clock from external system PIC16F630/676 osc1 osc2 (1) open note 1: functions as ra4 in ec osc mode.
PIC16F630/676 ds40039d-page 56 ? 2006 microchip technology inc. 9.2.3 external clock in for applications where a clock is already available elsewhere, users may directly drive the PIC16F630/ 676 provided that this external clock source meets the ac/dc timing requirements listed in section 12.0. figure 9-2 shows how an external clock circuit should be configured. 9.2.4 rc oscillator for applications where precise timing is not a requirement, the rc oscillator option is available. the operation and functionality of the rc oscillator is dependent upon a number of variables. the rc oscillator frequency is a function of: ? supply voltage ? resistor (r ext ) and capacitor (c ext ) values ? operating temperature the oscillator frequency will vary from unit to unit due to normal process parameter variation. the difference in lead frame capacitance between package types will also affect the oscillation frequency, especially for low c ext values. the user also needs to account for the tolerance of the external r and c components. figure 9-3 shows how the r/c combination is connected. two options are available for this oscillator mode which allow ra4 to be used as a general purpose i/o or to output f osc /4. figure 9-3: rc oscillator mode 9.2.5 internal 4 mh z oscillator when calibrated, the internal oscillator provides a fixed 4 mhz (nominal) system clock. see electrical specifications, section 12.0, for information on variation over voltage and temperature. two options are available for this oscillator mode which allow ra4 to be used as a general purpose i/o or to output f osc /4. 9.2.5.1 calibrating the internal oscillator a calibration instruction is programmed into the last location of program memory. this instruction is a retlw xx , where the literal is the calibration value. the literal is placed in the osccal register to set the calibration of the internal oscillator. example 9-1 demonstrates how to calibrate the internal oscillator. for best operation, decouple (with capacitance) v dd and v ss as close to the device as possible. example 9-1: calibrating the internal oscillator 9.2.6 clkout the PIC16F630/676 devices can be configured to provide a clock out signal in the intosc and rc oscillator modes. when configured, the oscillator frequency divided by four (f osc /4) is output on the ra4/osc2/clkout pin. f osc /4 can be used for test purposes or to synchronize other logic. ra4/osc2/clkout c ext v dd r ext v ss PIC16F630/676 ra5/osc1/ f osc /4 internal clock clkin note: erasing the device will also erase the pre- programmed internal calibration value for the internal oscillator. the calibration value must be saved prior to erasing part as specified in the PIC16F630/676 program- ming specification. microchip develop- ment tools maintain all calibration bits to factory settings. bsf status, rp0 ;bank 1 call 3ffh ;get the cal value movwf osccal ;calibrate bcf status, rp0 ;bank 0
? 2006 microchip technology inc. ds40039d-page 57 PIC16F630/676 9.3 reset the PIC16F630/676 differentiates between various kinds of reset: a) power-on reset (por) b) wdt reset during normal operation c) wdt reset during sleep d) mclr reset during normal operation e) mclr reset during sleep f) brown-out detect (bod) some registers are not affected in any reset condition; their status is unknown on por and unchanged in any other reset. most other registers are reset to a ?reset state? on: ? power-on reset ?mclr reset ?wdt reset ? wdt reset during sleep ? brown-out detect (bod) they are not affected by a wdt wake-up, since this is viewed as the resumption of normal operation. to and pd bits are set or cleared differently in different reset situations as indicated in table 9-4. these bits are used in software to determine the nature of the reset. see table 9-7 for a full description of reset states of all registers. a simplified block diagram of the on-chip reset circuit is shown in figure 9-4. the mclr reset path has a noise filter to detect and ignore small pulses. see table 12-4 in electrical specifications section for pulse width specification. figure 9-4: simplified block diagram of on-chip reset circuit s r q external reset mclr / v dd osc1/ wdt module v dd rise detect ost/pwrt on-chip (1) rc osc wdt time-out power-on reset ost pwrt chip_reset 10-bit ripple counter reset enable ost enable pwrt sleep see table 9-3 for time-out situations. note 1: this is a separate oscillator from the intosc/ec oscillator. brown-out detect boden clkin pin v pp pin 10-bit ripple counter q
PIC16F630/676 ds40039d-page 58 ? 2006 microchip technology inc. 9.3.1 mclr PIC16F630/676 devices have a noise filter in the mclr reset path. the filter will detect and ignore small pulses. it should be noted that a wdt reset does not drive mclr pin low. the behavior of the esd protection on the mclr pin has been altered from previous devices of this family. voltages applied to the pin that exceed its specification can result in both mclr resets and excessive current beyond the device specification during the esd event. for this reason, microchip recommends that the mclr pin no longer be tied directly to v dd . the use of an rc network, as shown in figure 9-5, is suggested. an internal mclr option is enabled by setting the mclre bit in the configuration word. when enabled, mclr is internally tied to v dd . no internal pull-up option is available for the mclr pin. figure 9-5: recommended mclr circuit 9.3.2 power-on reset (por) the on-chip por circuit holds the chip in reset until v dd has reached a high enough level for proper operation. to take advantage of the por, simply tie the mclr pin through a resistor to v dd . this will eliminate external rc components usually needed to create power-on reset. a maximum rise time for v dd is required. see electrical specifications for details (see section 12.0). if the bod is enabled, the maximum rise time specification does not apply. the bod circuitry will keep the device in reset until v dd reaches v bod (see section 9.3.5). when the device starts normal operation (exits the reset condition), device operating parameters (i.e., voltage, frequency, temperature, etc.) must be met to ensure operation. if these conditions are not met, the device must be held in reset until the operating conditions are met. for additional information, refer to application note an607 ?power-up trouble shooting? . 9.3.3 power-up timer (pwrt) the power-up timer provides a fixed 72 ms (nominal) time-out on power-up only, from por or brown-out detect. the power-up timer operates on an internal rc oscillator. the chip is kept in reset as long as pwrt is active. the pwrt delay allows the v dd to rise to an acceptable level. a configuration bit, pwrte can disable (if set) or enable (if cleared or programmed) the power-up timer. the power-up timer should always be enabled when brown-out detect is enabled. the power-up time delay will vary from chip to chip and due to: ?v dd variation ? temperature variation ? process variation. see dc parameters for details (section 12.0). 9.3.4 oscillator start-up timer (ost) the oscillator start-up timer (ost) provides a 1024 oscillator cycle (from osc1 input) delay after the pwrt delay is over. this ensures that the crystal oscillator or resonator has started and stabilized. the ost time-out is invoked only for xt, lp and hs modes and only on power-on reset or wake-up from sleep. note: the por circuit does not produce an inter- nal reset when v dd declines. v dd PIC16F630/676 mclr r1 1 k ( or greater ) c1 0.1 f (optional, not critical)
? 2006 microchip technology inc. ds40039d-page 59 PIC16F630/676 9.3.5 brown-out detect (bod) the PIC16F630/676 members have on-chip brown-out detect circuitry. a configuration bit, boden, can disable (if clear/programmed) or enable (if set) the brown-out detect circuitry. if v dd falls below v bod for greater than parameter (t bod ) in table 12-4 (see section 12.0), the brown-out situation will reset the device. this will occur regardless of v dd slew-rate. a reset is not guaranteed to occur if v dd falls below v bod for less than parameter (t bod ). on any reset (power-on, brown-out detect, watchdog, etc.), the chip will remain in reset until v dd rises above bv dd (see figure 9-6). the power-up timer will now be invoked, if enabled, and will keep the chip in reset an additional 72 ms. if v dd drops below bv dd while the power-up timer is running, the chip will go back into a brown-out detect and the power-up timer will be re-initialized. once v dd rises above bv dd , the power-up timer will execute a 72 ms reset. figure 9-6: brown-o ut situations 9.3.6 time-out sequence on power-up, the time-out sequence is as follows: first, pwrt time-out is invoked after por has expired. then, ost is activated. the total time-out will vary based on oscillator configuration and pwrte bit status. for example, in ec mode with pwrte bit erased (pwrt disabled), there will be no time-out at all. figure 9-7, figure 9-8 and figure 9-9 depict time- out sequences. since the time-outs occur from the por pulse, if mclr is kept low long enough, the time-outs will expire. then bringing mclr high will begin execution immediately (see figure 9-8). this is useful for testing purposes or to synchronize more than one PIC16F630/676 device operating in parallel. table 9-6 shows the reset conditions for some special registers, while table 9-7 shows the reset conditions for all the registers. 9.3.7 power control (pcon) status register the power control/status register, pcon (address 8eh) has two bits. bit0 is bod (brown-out). bod is unknown on power- on reset. it must then be set by the user and checked on subsequent resets to see if bod = 0, indicating that a brown-out has occurred. the bod status bit is a don?t care and is not necessarily predictable if the brown-out circuit is disabled (by setting boden bit = 0 in the configuration word). bit1 is por (power-on reset). it is a ?0? on power-on reset and unaffected otherwise. the user must write a ?1? to this bit following a power-on reset. on a subsequent reset, if por is ?0?, it will indicate that a power-on reset must have occurred (i.e., v dd may have gone too low). note: a brown-out detect does not enable the power-up timer if the pwrte bit in the configuration word is set. 72 ms (1) v bod v dd internal reset v bod v dd internal reset 72 ms (1) <72 ms 72 ms (1) v bod v dd internal reset note 1: 72 ms delay only if pwrte bit is programmed to ?0?.
PIC16F630/676 ds40039d-page 60 ? 2006 microchip technology inc. table 9-3: time-out in various situations table 9-4: status/pcon bits and their significance table 9-5: summary of registers associated with brown-out table 9-6: initialization condi tion for special registers oscillator configuration power-up brown-out detect wake-up from sleep pwrte = 0 pwrte = 1 pwrte = 0 pwrte = 1 xt, hs, lp t pwrt + 1024?t osc 1024?t osc t pwrt + 1024?t osc 1024?t osc 1024?t osc rc, ec, intosc t pwrt ?t pwrt ?? por bod to pd 0u11 power-on reset 1011 brown-out detect uu0u wdt reset uu00 wdt wake-up uuuu mclr reset during normal operation uu10 mclr reset during sleep legend: u = unchanged, x = unknown address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bod value on all other resets (1) 03h status irp rp1 rpo to pd z dc c 0001 1xxx 000q quuu 8eh pcon ? ? ? ? ? ?por bod ---- --0x ---- --uq legend: u = unchanged, x = unknown, - = unimplemented bit, reads as ?0?, q = value depends on condition. note 1: other (non power-up) resets include mclr reset, brown-out detect and watchdog timer reset during normal operation. condition program counter status register pcon register power-on reset 000h 0001 1xxx ---- --0x mclr reset during normal operation 000h 000u uuuu ---- --uu mclr reset during sleep 000h 0001 0uuu ---- --uu wdt reset 000h 0000 uuuu ---- --uu wdt wake-up pc + 1 uuu0 0uuu ---- --uu brown-out detect 000h 0001 1uuu ---- --10 interrupt wake-up from sleep pc + 1 (1) uuu1 0uuu ---- --uu legend: u = unchanged, x = unknown, - = unimplemented bit, reads as ?0?. note 1: when the wake-up is due to an interrupt and global enable bit gie is set, the pc is loaded with the interrupt vector (0004h) after execution of pc+1.
? 2006 microchip technology inc. ds40039d-page 61 PIC16F630/676 table 9-7: initialization condition for registers register address power-on reset ?mclr reset ? wdt reset ? brown-out detect (1) ? wake-up from sleep through interrupt ? wake-up from sleep through wdt time-out w? xxxx xxxx uuuu uuuu uuuu uuuu indf 00h/80h ? ? ? tmr0 01h xxxx xxxx uuuu uuuu uuuu uuuu pcl 02h/82h 0000 0000 0000 0000 pc + 1 (3) status 03h/83h 0001 1xxx 000q quuu (4) uuuq quuu (4) fsr 04h/84h xxxx xxxx uuuu uuuu uuuu uuuu porta 05h --xx xxxx --uu uuuu --uu uuuu portc 07h --xx xxxx --uu uuuu --uu uuuu pclath 0ah/8ah ---0 0000 ---0 0000 ---u uuuu intcon 0bh/8bh 0000 0000 0000 000u uuuu uuqq (2) pir1 0ch 00-- 0--0 00-- 0--0 qq-- q--q (2,5) t1con 10h -000 0000 -uuu uuuu -uuu uuuu cmcon 19h -0-0 0000 -0-0 0000 -u-u uuuu adresh 1eh xxxx xxxx uuuu uuuu uuuu uuuu adcon0 1fh 00-0 0000 00-0 0000 uu-u uuuu option_reg 81h 1111 1111 1111 1111 uuuu uuuu trisa 85h --11 1111 --11 1111 --uu uuuu trisc 87h --11 1111 --11 1111 --uu uuuu pie1 8ch 00-- 0--0 00-- 0--0 uu-- u--u pcon 8eh ---- --0x ---- --uu (1,6) ---- --uu osccal 90h 1000 00-- 1000 00-- uuuu uu-- ansel 91h 1111 1111 1111 1111 uuuu uuuu wpua 95h --11 -111 --11 -111 uuuu uuuu ioca 96h --00 0000 --00 0000 --uu uuuu vrcon 99h 0-0- 0000 0-0- 0000 u-u- uuuu eedata 9ah 0000 0000 0000 0000 uuuu uuuu eeadr 9bh -000 0000 -000 0000 -uuu uuuu eecon1 9ch ---- x000 ---- q000 ---- uuuu eecon2 9dh ---- ---- ---- ---- ---- ---- adresl 9eh xxxx xxxx uuuu uuuu uuuu uuuu adcon1 9fh -000 ---- -000 ---- -uuu ---- legend: u = unchanged, x = unknown, - = unimplemented bit, reads as ?0?, q = value depends on condition. note 1: if v dd goes too low, power-on reset will be activated and registers will be affected differently. 2: one or more bits in intcon and/or pir1 will be affected (to cause wake-up). 3: when the wake-up is due to an interrupt and the gie bit is set, the pc is loaded with the interrupt vector (0004h). 4: see table 9-6 for reset value for specific condition. 5: if wake-up was due to data eeprom write completing, bit 7 = 1; a/d conversion completing, bit 6 = 1; comparator input changing, bit 3 = 1; or timer1 rolling over, bit 0 = 1. all other interrupts generating a wake-up will cause these bits to = u. 6: if reset was due to brown-out, then bit 0 = 0. all other resets will cause bit 0 = u.
PIC16F630/676 ds40039d-page 62 ? 2006 microchip technology inc. figure 9-7: time-out sequence on power-up (mclr not tied to v dd ): case 1 figure 9-8: time-out sequence on power-up (mclr not tied to v dd ): case 2 figure 9-9: time-out sequence on power-up (mclr tied to v dd ) t pwrt t ost v dd mclr internal por pwrt time-out ost time-out internal reset v dd mclr internal por pwrt time-out ost time-out internal reset t pwrt t ost t pwrt t ost v dd mclr internal por pwrt time-out ost time-out internal reset
? 2006 microchip technology inc. ds40039d-page 63 PIC16F630/676 9.4 interrupts the PIC16F630/676 has 7 sources of interrupt: ? external interrupt ra2/int ? tmr0 overflow interrupt ? porta change interrupts ? comparator interrupt ? a/d interrupt (pic16f676 only) ? tmr1 overflow interrupt ? eeprom data write interrupt the interrupt control register (intcon) and peripheral interrupt register (pir) record individual interrupt requests in flag bits. the intcon register also has individual and global interrupt enable bits. a global interrupt enable bit, gie (intcon<7>) enables (if set) all unmasked interrupts, or disables (if cleared) all interrupts. individual interrupts can be disabled through their corresponding enable bits in intcon register and pie register. gie is cleared on reset. the return from interrupt instruction, retfie , exits interrupt routine, as well as sets the gie bit, which re- enables unmasked interrupts. the following interrupt flags are contained in the intcon register: ? int pin interrupt ? porta change interrupt ? tmr0 overflow interrupt the peripheral interrupt flags are contained in the special register pir1. the corresponding interrupt enable bit is contained in special register pie1. the following interrupt flags are contained in the pir register: ? eeprom data write interrupt ? a/d interrupt ? comparator interrupt ? timer1 overflow interrupt when an interrupt is serviced: ? the gie is cleared to disable any further interrupt ? the return address is pushed onto the stack ? the pc is loaded with 0004h once in the interrupt service routine, the source(s) of the interrupt can be determined by polling the interrupt flag bits. the interrupt flag bit(s) must be cleared in soft- ware before re-enabling interrupts to avoid ra2/int recursive interrupts. for external interrupt events, such as the int pin, or porta change interrupt, the interrupt latency will be three or four instruction cycles. the exact latency depends upon when the interrupt event occurs (see figure 9-11). the latency is the same for one or two- cycle instructions. once in the interrupt service routine, the source(s) of the interrupt can be determined by polling the interrupt flag bits. the interrupt flag bit(s) must be cleared in software before re-enabling interrupts to avoid multiple interrupt requests. note 1: individual interrupt flag bits are set, regardless of the status of their corresponding mask bit or the gie bit. 2: when an instruction that clears the gie bit is executed, any interrupts that were pending for execution in the next cycle are ignored. the interrupts which were ignored are still pending to be serviced when the gie bit is set again.
PIC16F630/676 ds40039d-page 64 ? 2006 microchip technology inc. figure 9-10: interrupt logic tmr1if tmr1ie cmif cmie t0if t0ie intf inte raif raie gie peie wake-up (if in sleep mode) interrupt to cpu eeie eeif adif adie (1) note 1: pic16f676 only. ioca-ra0 ioca0 ioca-ra1 ioca1 ioca-ra2 ioca2 ioca-ra3 ioca3 ioca-ra4 ioca4 ioca-ra5 ioca5
? 2006 microchip technology inc. ds40039d-page 65 PIC16F630/676 9.4.1 ra2/int interrupt external interrupt on ra2/int pin is edge-triggered; either rising if intedg bit (option<6>) is set, or falling, if intedg bit is clear. when a valid edge appears on the ra2/int pin, the intf bit (intcon<1>) is set. this interrupt can be disabled by clearing the inte control bit (intcon<4>). the intf bit must be cleared in software in the interrupt service routine before re-enabling this interrupt. the ra2/int interrupt can wake-up the processor from sleep if the inte bit was set prior to going into sleep. the status of the gie bit decides whether or not the processor branches to the interrupt vector following wake-up. see section 9.7 for details on sleep and figure 9-13 for timing of wake-up from sleep through ra2/int interrupt. 9.4.2 tmr0 interrupt an overflow (ffh 00h) in the tmr0 register will set the t0if (intcon<2>) bit. the interrupt can be enabled/disabled by setting/clearing t0ie (intcon<5>) bit. for operation of the timer0 module, see section 4.0. 9.4.3 porta interrupt an input change on porta change sets the raif (intcon<0>) bit. the interrupt can be enabled/ disabled by setting/clearing the raie (intcon<3>) bit. plus individual pins can be configured through the ioca register. 9.4.4 comparator interrupt see section 6.9 for description of comparator interrupt. 9.4.5 a/d converter interrupt after a conversion is complete, the adif flag (pir<6>) is set. the interrupt can be enabled/disabled by setting or clearing adie (pie<6>). see section 7.0 for operation of the a/d converter interrupt. figure 9-11: int pin interrupt timing note: the ansel (91h) and cmcon (19h) registers must be initialized to configure an analog channel as a digital input. pins configured as analog inputs will read ?0?. the ansel register is defined for the pic16f676. note: if a change on the i/o pin should occur when the read operation is being executed (start of the q2 cycle), then the raif inter- rupt flag may not get set. q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 osc1 clkout int pin intf flag (intcon<1>) gie bit (intcon<7>) instruction flow pc instruction fetched instruction executed interrupt latency pc pc+1 pc+1 0004h 0005h inst (0004h) inst (0005h) dummy cycle inst (pc) inst (pc+1) inst (pc-1) inst (0004h) dummy cycle inst (pc) ? 1 4 5 1 2 3 note 1: intf flag is sampled here (every q1). 2: asynchronous interrupt latency = 3-4 t cy . synchronous latency = 3 t cy , where t cy = instruction cycle time. latency is the same whether inst (pc) is a single cycle or a 2-cycle instruction. 3: clkout is available only in rc oscillator mode. 4: for minimum width of int pulse, refer to ac specs. 5: intf is enabled to be set any time during the q4-q1 cycles.
PIC16F630/676 ds40039d-page 66 ? 2006 microchip technology inc. table 9-8: summary of interrupt registers 9.5 context saving during interrupts during an interrupt, only the return pc value is saved on the stack. typically, users may wish to save key registers during an interrupt (e.g., w register and status register). this must be implemented in software. example 9-2 stores and restores the status and w registers. the user register, w_temp, must be defined in both banks and must be defined at the same offset from the bank base address (i.e., w_temp is defined at 0x20 in bank 0 and it must also be defined at 0xa0 in bank 1). the user register, status_temp, must be defined in bank 0. the example 9-2: ? stores the w register ? stores the status register in bank 0 ? executes the isr code ? restores the status (and bank select bit register) ? restores the w register example 9-2: saving the status and w registers in ram 9.6 watchdog timer (wdt) the watchdog timer is a free running, on-chip rc oscillator, which requires no external components. this rc oscillator is separate from the external rc oscillator of the clkin pin. that means that the wdt will run, even if the clock on the osc1 and osc2 pins of the device has been stopped (for example, by execution of a sleep instruction). during normal operation, a wdt time-out generates a device reset. if the device is in sleep mode, a wdt time-out causes the device to wake-up and continue with normal operation. the wdt can be permanently disabled by programming the configuration bit wdte as clear (section 9.1). 9.6.1 wdt period the wdt has a nominal time-out period of 18 ms, (with no prescaler). the time-out periods vary with tempera- ture, v dd and process variations from part to part (see dc specs). if longer time-out periods are desired, a prescaler with a division ratio of up to 1:128 can be assigned to the wdt under software control by writing to the option register. thus, time-out periods up to 2.3 seconds can be realized. the clrwdt and sleep instructions clear the wdt and the prescaler, if assigned to the wdt, and prevent it from timing out and generating a device reset. the to bit in the status register will be cleared upon a watchdog timer time-out. 9.6.2 wdt programming considerations it should also be taken in account that under worst case conditions (i.e., v dd = min., temperature = max., max. wdt prescaler) it may take several seconds before a wdt time-out occurs. addressnamebit 7bit 6bit 5bit 4bit 3bit 2 bit 1bit 0 value on por, bod value on all other resets 0bh, 8bh intcon gie peie t0ie inte raie t0if intf raif 0000 0000 0000 000u 0ch pir1 eeif adif ? ?cmif ? ?tmr1if 00-- 0--0 00-- 0--0 8ch pie1 eeie adie ? ?cmie ? ?tmr1ie 00-- 0--0 00-- 0--0 legend: x = unknown, u = unchanged, - = unimplemented r ead as '0', q = value depends upon condition. shaded cells are not used by the interrupt module. movwf w_temp ;copy w to temp register, could be in either bank swapf status,w ;swap status to be saved into w bcf status,rp0 ;change to bank 0 regardless of current bank movwf status_temp ;save status to bank 0 register : :(isr) : swapf status_temp,w;swap status_temp register into w, sets bank to original state movwf status ;move w into status register swapf w_temp,f ;swap w_temp swapf w_temp,w ;swap w_temp into w
? 2006 microchip technology inc. ds40039d-page 67 PIC16F630/676 figure 9-12: watchdog timer block diagram table 9-9: summary of watchdog timer registers t0cki t0se pin clkout tmr0 watchdog timer wdt time-out ps0 - ps2 wdte data bus set flag bit t0if on overflow t0cs note 1: t0se, t0cs, psa, ps0-ps2 are bits in the option register. 0 1 0 1 0 1 sync 2 cycles 8 8 8-bit prescaler 0 1 (= f osc /4) psa psa psa address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 value on por, bod value on all other resets 81h option_reg rapu intedg t0cs t0se psa ps2 ps1 ps0 1111 1111 1111 1111 2007h config. bits cp boden mclre pwrte wdte f0sc2 f0sc1 f0sc0 uuuu uuuu uuuu uuuu legend: u = unchanged, shaded cells are not used by the watchdog timer.
PIC16F630/676 ds40039d-page 68 ? 2006 microchip technology inc. 9.7 power-down mode (sleep) the power-down mode is entered by executing a sleep instruction. if the watchdog timer is enabled: ? wdt will be cleared but keeps running ?pd bit in the status register is cleared ?to bit is set ? oscillator driver is turned off ? i/o ports maintain the status they had before sleep was executed (driving high, low, or hi-impedance). for lowest current consumption in this mode, all i/o pins should be either at v dd , or v ss , with no external circuitry drawing current from the i/o pin and the comparators and cv ref should be disabled. i/o pins that are hi-impedance inputs should be pulled high or low externally to avoid switching currents caused by floating inputs. the t0cki input should also be at v dd or v ss for lowest current consumption. the contribution from on-chip pull-ups on porta should be considered. the mclr pin must be at a logic high level (v ihmc ). 9.7.1 wake-up from sleep the device can wake-up from sleep through one of the following events: 1. external reset input on mclr pin 2. watchdog timer wake-up (if wdt was enabled) 3. interrupt from ra2/int pin, porta change, or a peripheral interrupt. the first event will cause a device reset. the two latter events are considered a continuation of program execution. the to and pd bits in the status register can be used to determine the cause of device reset. the pd bit, which is set on power-up, is cleared when sleep is invoked. to bit is cleared if wdt wake-up occurred. when the sleep instruction is being executed, the next instruction (pc + 1) is pre-fetched. for the device to wake-up through an interrupt event, the correspond- ing interrupt enable bit must be set (enabled). wake-up is regardless of the state of the gie bit. if the gie bit is clear (disabled), the device continues execution at the instruction after the sleep instruction. if the gie bit is set (enabled), the device executes the instruction after the sleep instruction, then branches to the interrupt address (0004h). in cases where the execution of the instruction following sleep is not desirable, the user should have an nop after the sleep instruction. the wdt is cleared when the device wakes up from sleep, regardless of the source of wake-up. figure 9-13: wake-up from sleep through interrupt note: it should be noted that a reset generated by a wdt time-out does not drive mclr pin low. note: if the global interrupts are disabled (gie is cleared), but any interrupt source has both its interrupt enable bit and the correspond- ing interrupt flag bits set, the device will immediately wake-up from sleep. the sleep instruction is completely executed. q1 q2 q3 q4 q1 q2 q3 q4 q1 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 osc1 clkout (4) int pin intf flag (intcon<1>) gie bit (intcon<7>) instruction flow pc instruction fetched instruction executed pc pc+1 pc+2 inst(pc) = sleep inst(pc - 1) inst(pc + 1) sleep processor in sleep interrupt latency (note 3) inst(pc + 2) inst(pc + 1) inst(0004h) inst(0005h) inst(0004h) dummy cycle pc + 2 0004h 0005h dummy cycle t ost (2) pc+2 note 1: xt, hs or lp oscillator mode assumed. 2: t ost = 1024t osc (drawing not to scale). approximately 1 s delay for rc oscillator mode. see section 12 for wake-up from sleep delay in intosc mode. 3: gie = '1' assumed. in this case after wake-up, the processor jumps to the interrupt routine. if gie = '0', execution will conti nue in-line. 4: clkout is not available in xt, hs, lp or ec osc modes, but shown here for timing reference.
? 2006 microchip technology inc. ds40039d-page 69 PIC16F630/676 9.8 code protection if the code protection bit(s) have not been programmed, the on-chip program memory can be read out for verification purposes. 9.9 id locations four memory locations (2000h-2003h) are designated as id locations where the user can store checksum or other code identification numbers. these locations are not accessible during normal execution but are readable and writable during program/verify. only the least significant 7 bits of the id locations are used. 9.10 in-circuit serial programming the PIC16F630/676 microcontrollers can be serially programmed while in the end application circuit. this is simply done with two lines for clock and data, and three other lines for: ? power ? ground ? programming voltage this allows customers to manufacture boards with unprogrammed devices and then program the micro- controller just before shipping the product. this also allows the most recent firmware or a custom firmware to be programmed. the device is placed into a program/verify mode by holding the ra0 and ra1 pins low, while raising the mclr (v pp ) pin from v il to v ihh (see programming specification). ra0 becomes the programming data and ra1 becomes the programming clock. both ra0 and ra1 are schmitt trigger inputs in this mode. after reset, to place the device into programming/ verify mode, the program counter (pc) is at location 00h. a 6-bit command is then supplied to the device. depending on the command, 14 bits of program data are then supplied to or from the device, depending on whether the command was a load or a read. for complete details of serial programming, please refer to the PIC16F630/676 programming specification. a typical in-circuit serial programming connection is shown in figure 9-14. figure 9-14: typical in-circuit serial programming connection 9.11 in-circuit debugger since in-circuit debugging requires the loss of clock, data and mclr pins, mplab ? icd 2 development with an 14-pin device is not practical. a special 20-pin pic16f676-icd device is used with mplab icd 2 to provide separate clock, data and mclr pins and frees all normally available pins to the user. this special icd device is mounted on the top of the header and its signals are routed to the mplab icd 2 connector. on the bottom of the header is an 14-pin socket that plugs into the user?s target via the 14-pin stand-off connector. when the icd pin on the pic16f676-icd device is held low, the in-circuit debugger functionality is enabled. this function allows simple debugging functions when used with mplab icd 2. when the microcontroller has this feature enabled, some of the resources are not available for general use. table 9-10 shows which features are consumed by the background debugger: table 9-10: debugger resources for more information, see 14-pin mplab icd 2 header information sheet (ds51299) available on microchip?s website (www.microchip.com). note: the entire data eeprom and flash program memory will be erased when the code protection is turned off. the intosc calibration data is also erased. see PIC16F630/676 programming specifica- tion for more information. i/o pins icdclk, icddata stack 1 level program memory address 0h must be nop 300h - 3feh external connector signals to n o r m a l connections to n o r m a l connections PIC16F630/676 v dd v ss ra3/mclr /v pp ra1 ra0 +5v 0v v pp clk data i/o v dd
PIC16F630/676 ds40039d-page 70 ? 2006 microchip technology inc. notes:
? 2006 microchip technology inc. ds40039d-page 71 PIC16F630/676 10.0 instruction set summary the PIC16F630/676 instruction set is highly orthogonal and is comprised of three basic categories: ? byte-oriented operations ? bit-oriented operations ? literal and control operations each pic16 instruction is a 14-bit word divided into an opcode, which specifies the instruction type, and one or more operands, which further specify the operation of the instruction. the formats for each of the categories is presented in figure 10-1, while the various opcode fields are summarized in table 10-1. table 10-2 lists the instructions recognized by the mpasm tm assembler. a complete description of each instruction is also available in the pic ? mid-range ref- erence manual (ds33023). for byte-oriented instructions, ? f ? represents a file register designator and ? d ? represents a destination designator. the file register designator specifies which file register is to be used by the instruction. the destination designator specifies where the result of the operation is to be placed. if ? d ? is zero, the result is placed in the w register. if ? d ? is one, the result is placed in the file register specified in the instruction. for bit-oriented instructions, ? b ? represents a bit field designator, which selects the bit affected by the operation, while ? f ? represents the address of the file in which the bit is located. for literal and control operations, ? k ? represents an 8-bit or 11-bit constant, or literal value one instruction cycle consists of four oscillator periods; for an oscillator frequency of 4 mhz, this gives a normal instruction execution time of 1 s. all instructions are executed within a single instruction cycle, unless a conditional test is true, or the program counter is changed as a result of an instruction. when this occurs, the execution takes two instruction cycles, with the second cycle executed as a nop . all instruction examples use the format ?0xhh? to represent a hexadecimal number, where ?h? signifies a hexadecimal digit. 10.1 read-modify-write operations any instruction that specifies a file register as part of the instruction performs a read-modify-write (r-m-w) operation. the register is read, the data is modified, and the result is stored according to either the instruc- tion, or the destination designator ?d?. a read operation is performed on a register even if the instruction writes to that register. for example, a clrf porta instruction will read porta, clear all the data bits, then write the result back to porta. this example would have the unintended result of clearing the condition that set the raif flag. table 10-1: opcode field descriptions figure 10-1: general format for instructions note: to maintain upward compatibility with future products, do not use the option and tris instructions. field description f register file address (0x00 to 0x7f) w working register (accumulator) b bit address within an 8-bit file register k literal field, constant data or label x don't care location (= 0 or 1 ). the assembler will generate code with x = 0 . it is the recommended form of use for compatibility with all microchip software tools. d destination select; d = 0 : store result in w, d = 1: store result in file register f. default is d = 1. pc program counter to time-out bit pd power-down bit byte-oriented file register operations 13 8 7 6 0 d = 0 for destination w opcode d f (file #) d = 1 for destination f f = 7-bit file register address bit-oriented file register operations 13 10 9 7 6 0 opcode b (bit #) f (file #) b = 3-bit bit address f = 7-bit file register address literal and control operations 13 8 7 0 opcode k (literal) k = 8-bit immediate value 13 11 10 0 opcode k (literal) k = 11-bit immediate value general call and goto instructions only
PIC16F630/676 ds40039d-page 72 ? 2006 microchip technology inc. table 10-2: PIC16F630/676 instruction set mnemonic, operands description cycles 14-bit opcode status affected notes msb lsb byte-oriented file register operations addwf andwf clrf clrw comf decf decfsz incf incfsz iorwf movf movwf nop rlf rrf subwf swapf xorwf f, d f, d f - f, d f, d f, d f, d f, d f, d f, d f - f, d f, d f, d f, d f, d add w and f and w with f clear f clear w complement f decrement f decrement f, skip if 0 increment f increment f, skip if 0 inclusive or w with f move f move w to f no operation rotate left f through carry rotate right f through carry subtract w from f swap nibbles in f exclusive or w with f 1 1 1 1 1 1 1(2) 1 1(2) 1 1 1 1 1 1 1 1 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0111 0101 0001 0001 1001 0011 1011 1010 1111 0100 1000 0000 0000 1101 1100 0010 1110 0110 dfff dfff lfff 0xxx dfff dfff dfff dfff dfff dfff dfff lfff 0xx0 dfff dfff dfff dfff dfff ffff ffff ffff xxxx ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff c,dc,z z z z z z z z z c c c,dc,z z 1,2 1,2 2 1,2 1,2 1,2,3 1,2 1,2,3 1,2 1,2 1,2 1,2 1,2 1,2 1,2 bit-oriented file register operations bcf bsf btfsc btfss f, b f, b f, b f, b bit clear f bit set f bit test f, skip if clear bit test f, skip if set 1 1 1 (2) 1 (2) 01 01 01 01 00bb 01bb 10bb 11bb bfff bfff bfff bfff ffff ffff ffff ffff 1,2 1,2 3 3 literal and control operations addlw andlw call clrwdt goto iorlw movlw retfie retlw return sleep sublw xorlw k k k - k k k - k - - k k add literal and w and literal with w call subroutine clear watchdog timer go to address inclusive or literal with w move literal to w return from interrupt return with literal in w return from subroutine go into standby mode subtract w from literal exclusive or literal with w 1 1 2 1 2 1 1 2 2 2 1 1 1 11 11 10 00 10 11 11 00 11 00 00 11 11 111x 1001 0kkk 0000 1kkk 1000 00xx 0000 01xx 0000 0000 110x 1010 kkkk kkkk kkkk 0110 kkkk kkkk kkkk 0000 kkkk 0000 0110 kkkk kkkk kkkk kkkk kkkk 0100 kkkk kkkk kkkk 1001 kkkk 1000 0011 kkkk kkkk c,dc,z z to ,pd z to ,pd c,dc,z z note 1: when an i/o register is modified as a function of itself (e.g., movf porta , 1 ), the value used will be that value present on the pins themselves. for example, if the data latch is '1' for a pin configured as input and is driven low by an external device, the data will be written back with a '0'. 2: if this instruction is executed on the tmr0 register (and, wher e applicable, d = 1), the prescaler will be cleared if assigned to the timer0 module. 3: if program counter (pc) is modified, or a conditional test is true, the instruction requires two cycles. the second cycle is executed as a nop . note: additional information on the mid-range instruction set is available in the pic ? mid-range mcu family ref- erence manual (ds33023).
? 2006 microchip technology inc. ds40039d-page 73 PIC16F630/676 10.2 instruction descriptions addlw add literal and w syntax: [ label ] addlw k operands: 0 k 255 operation: (w) + k (w) status affected: c, dc, z description: the contents of the w register are added to the eight-bit literal 'k' and the result is placed in the w register. addwf add w and f syntax: [ label ] addwf f,d operands: 0 f 127 d [0,1] operation: (w) + (f) (destination) status affected: c, dc, z description: add the contents of the w register with register 'f'. if 'd' is 0, the result is stored in the w register. if 'd' is 1, the result is stored back in register 'f'. andlw and literal with w syntax: [ label ] andlw k operands: 0 k 255 operation: (w) .and. (k) (w) status affected: z description: the contents of w register are and?ed with the eight-bit literal 'k'. the result is placed in the w register. andwf and w with f syntax: [ label ] andwf f,d operands: 0 f 127 d [0,1] operation: (w) .and. (f) (destination) status affected: z description: and the w register with register 'f'. if 'd' is 0, the result is stored in the w register. if 'd' is 1, the result is stored back in register 'f'. bcf bit clear f syntax: [ label ] bcf f,b operands: 0 f 127 0 b 7 operation: 0 (f) status affected: none description: bit 'b' in register 'f' is cleared. bsf bit set f syntax: [ label ] bsf f,b operands: 0 f 127 0 b 7 operation: 1 (f) status affected: none description: bit 'b' in register 'f' is set. btfss bit test f, skip if set syntax: [ label ] btfss f,b operands: 0 f 127 0 b < 7 operation: skip if (f) = 1 status affected: none description: if bit 'b' in register 'f' is '0', the next instruction is executed. if bit 'b' is '1', then the next instruc- tion is discarded and a nop is executed instead, making this a 2-cycle instruction. btfsc bit test, skip if clear syntax: [ label ] btfsc f,b operands: 0 f 127 0 b 7 operation: skip if (f) = 0 status affected: none description: if bit 'b' in register 'f' is '1', the next instruction is executed. if bit 'b', in register 'f', is '0', the next instruction is discarded, and a nop is executed instead, making this a 2-cycle instruction.
PIC16F630/676 ds40039d-page 74 ? 2006 microchip technology inc. call call subroutine syntax: [ label ] call k operands: 0 k 2047 operation: (pc)+ 1 tos, k pc<10:0>, (pclath<4:3>) pc<12:11> status affected: none description: call subroutine. first, return address (pc+1) is pushed onto the stack. the eleven-bit immedi- ate address is loaded into pc bits <10:0>. the upper bits of the pc are loaded from pclath. call is a two-cycle instruction. clrf clear f syntax: [ label ] clrf f operands: 0 f 127 operation: 00h (f) 1 z status affected: z description: the contents of register 'f' are cleared and the z bit is set. clrw clear w syntax: [ label ] clrw operands: none operation: 00h (w) 1 z status affected: z description: w register is cleared. zero bit (z) is set. clrwdt clear watchdog timer syntax: [ label ] clrwdt operands: none operation: 00h wdt 0 wdt prescaler, 1 to 1 pd status affected: to , pd description: clrwdt instruction resets the watchdog timer. it also resets the prescaler of the wdt. status bits to and pd are set. comf complement f syntax: [ label ] comf f,d operands: 0 f 127 d [0,1] operation: (f ) (destination) status affected: z description: the contents of register 'f' are complemented. if 'd' is 0, the result is stored in w. if 'd' is 1, the result is stored back in register 'f'. decf decrement f syntax: [ label ] decf f,d operands: 0 f 127 d [0,1] operation: (f) - 1 (destination) status affected: z description: decrement register 'f'. if 'd' is 0, the result is stored in the w register. if 'd' is 1, the result is stored back in register 'f'.
? 2006 microchip technology inc. ds40039d-page 75 PIC16F630/676 decfsz decrement f, skip if 0 syntax: [ label ] decfsz f,d operands: 0 f 127 d [0,1] operation: (f) - 1 (destination); skip if result = 0 status affected: none description: the contents of register 'f' are decremented. if 'd' is 0, the result is placed in the w register. if 'd' is 1, the result is placed back in register 'f'. if the result is 1, the next instruc- tion is executed. if the result is 0, then a nop is executed instead, making it a 2-cycle instruction. goto unconditional branch syntax: [ label ] goto k operands: 0 k 2047 operation: k pc<10:0> pclath<4:3> pc<12:11> status affected: none description: goto is an unconditional branch. the eleven-bit immediate value is loaded into pc bits <10:0>. the upper bits of pc are loaded from pclath<4:3>. goto is a two- cycle instruction. incf increment f syntax: [ label ] incf f,d operands: 0 f 127 d [0,1] operation: (f) + 1 (destination) status affected: z description: the contents of register 'f' are incremented. if 'd' is 0, the result is placed in the w register. if 'd' is 1, the result is placed back in register 'f'. incfsz increment f, skip if 0 syntax: [ label ] incfsz f,d operands: 0 f 127 d [0,1] operation: (f) + 1 (destination), skip if result = 0 status affected: none description: the contents of register 'f' are incremented. if 'd' is 0, the result is placed in the w register. if 'd' is 1, the result is placed back in register 'f'. if the result is 1, the next instruc- tion is executed. if the result is 0, a nop is executed instead, making it a 2-cycle instruction. iorlw inclusive or literal with w syntax: [ label ] iorlw k operands: 0 k 255 operation: (w) .or. k (w) status affected: z description: the contents of the w register are or?ed with the eight-bit literal 'k'. the result is placed in the w register. iorwf inclusive or w with f syntax: [ label ] iorwf f,d operands: 0 f 127 d [0,1] operation: (w) .or. (f) (destination) status affected: z description: inclusive or the w register with register 'f'. if 'd' is 0, the result is placed in the w register. if 'd' is 1, the result is placed back in register 'f'.
PIC16F630/676 ds40039d-page 76 ? 2006 microchip technology inc. movf move f syntax: [ label ] movf f,d operands: 0 f 127 d [0,1] operation: (f) (destination) status affected: z description: the contents of register f are moved to a destination dependant upon the status of d. if d = 0, destination is w register. if d = 1, the destination is file register f itself. d = 1 is useful to test a file register, since status flag z is affected. movlw move literal to w syntax: [ label ] movlw k operands: 0 k 255 operation: k (w) status affected: none description: the eight-bit literal 'k' is loaded into w register. the don?t cares will assemble as 0?s. movwf move w to f syntax: [ label ] movwf f operands: 0 f 127 operation: (w) (f) status affected: none description: move data from w register to register 'f'. nop no operation syntax: [ label ] nop operands: none operation: no operation status affected: none description: no operation. retfie return from interrupt syntax: [ label ] retfie operands: none operation: tos pc, 1 gie status affected: none retlw return with literal in w syntax: [ label ] retlw k operands: 0 k 255 operation: k (w); tos pc status affected: none description: the w register is loaded with the eight-bit literal 'k'. the program counter is loaded from the top of the stack (the return address). this is a two-cycle instruction.
? 2006 microchip technology inc. ds40039d-page 77 PIC16F630/676 rlf rotate left f through carry syntax: [ label ] rlf f,d operands: 0 f 127 d [0,1] operation: see description below status affected: c description: the contents of register 'f' are rotated one bit to the left through the carry flag. if 'd' is 0, the result is placed in the w register. if 'd' is 1, the result is stored back in register 'f'. return return from subroutine syntax: [ label ] return operands: none operation: tos pc status affected: none description: return from subroutine. the stack is poped and the top of the stack (tos) is loaded into the program counter. this is a two-cycle instruction. rrf rotate right f through carry syntax: [ label ] rrf f,d operands: 0 f 127 d [0,1] operation: see description below status affected: c description: the contents of register 'f' are rotated one bit to the right through the carry flag. if 'd' is 0, the result is placed in the w register. if 'd' is 1, the result is placed back in register 'f'. register f c register f c sleep syntax: [ label ] sleep operands: none operation: 00h wdt, 0 wdt prescaler, 1 to , 0 pd status affected: to , pd description: the power-down status bit, pd is cleared. time-out status bit, to is set. watchdog timer and its prescaler are cleared. the processor is put into sleep mode with the oscillator stopped. sublw subtract w from literal syntax: [ label ] sublw k operands: 0 k 255 operation: k - (w) ( w) status affected: c, dc, z description: the w register is subtracted (2?s complement method) from the eight-bit literal 'k'. the result is placed in the w register. subwf subtract w from f syntax: [ label ] subwf f,d operands: 0 f 127 d [0,1] operation: (f) - (w) ( destination) status affected: c, dc, z description: subtract (2?s complement method) w register from register 'f'. if 'd' is 0, the result is stored in the w register. if 'd' is 1, the result is stored back in register 'f'.
PIC16F630/676 ds40039d-page 78 ? 2006 microchip technology inc. swapf swap nibbles in f syntax: [ label ] swapf f,d operands: 0 f 127 d [0,1] operation: (f<3:0>) (destination<7:4>), (f<7:4>) (destination<3:0>) status affected: none description: the upper and lower nibbles of register 'f' are exchanged. if 'd' is 0, the result is placed in the w register. if 'd' is 1, the result is placed in register 'f'. xorlw exclusive or literal with w syntax: [ label ] xorlw k operands: 0 k 255 operation: (w) .xor. k ( w) status affected: z description: the contents of the w register are xor?ed with the eight-bit literal 'k'. the result is placed in the w register. xorwf exclusive or w with f syntax: [ label ] xorwf f,d operands: 0 f 127 d [0,1] operation: (w) .xor. (f) ( destination) status affected: z description: exclusive or the contents of the w register with register 'f'. if 'd' is 0, the result is stored in the w register. if 'd' is 1, the result is stored back in register 'f'.
? 2006 microchip technology inc. ds40039d-page 79 PIC16F630/676 11.0 development support the pic ? microcontrollers are supported with a full range of hardware and software development tools: ? integrated development environment - mplab ? ide software ? assemblers/compilers/linkers - mpasm tm assembler - mplab c18 and mplab c30 c compilers -mplink tm object linker/ mplib tm object librarian - mplab asm30 assembler/linker/library ? simulators - mplab sim software simulator ?emulators - mplab ice 2000 in-circuit emulator - mplab ice 4000 in-circuit emulator ? in-circuit debugger - mplab icd 2 ? device programmers - picstart ? plus development programmer - mplab pm3 device programmer - pickit? 2 development programmer ? low-cost demonstration and development boards and evaluation kits 11.1 mplab integrated development environment software the mplab ide software brings an ease of software development previously unseen in the 8/16-bit micro- controller market. the mplab ide is a windows ? operating system-based application that contains: ? a single graphical interface to all debugging tools - simulator - programmer (sold separately) - emulator (sold separately) - in-circuit debugger (sold separately) ? a full-featured editor with color-coded context ? a multiple project manager ? customizable data windows with direct edit of contents ? high-level source code debugging ? visual device initializer for easy register initialization ? mouse over variable inspection ? drag and drop variables from source to watch windows ? extensive on-line help ? integration of select third party tools, such as hi-tech software c compilers and iar c compilers the mplab ide allows you to: ? edit your source files (either assembly or c) ? one touch assemble (or compile) and download to pic mcu emulator and simulator tools (automatically updates all project information) ? debug using: - source files (assembly or c) - mixed assembly and c - machine code mplab ide supports multiple debugging tools in a single development paradigm, from the cost-effective simulators, through low-cost in-circuit debuggers, to full-featured emulators. this eliminates the learning curve when upgrading to tools with increased flexibility and power.
PIC16F630/676 ds40039d-page 80 ? 2006 microchip technology inc. 11.2 mpasm assembler the mpasm assembler is a full-featured, universal macro assembler for all pic mcus. the mpasm assembler generates relocatable object files for the mplink object linker, intel ? standard hex files, map files to detail memory usage and symbol reference, absolute lst files that contain source lines and generated machine code and coff files for debugging. the mpasm assembler features include: ? integration into mplab ide projects ? user-defined macros to streamline assembly code ? conditional assembly for multi-purpose source files ? directives that allow complete control over the assembly process 11.3 mplab c18 and mplab c30 c compilers the mplab c18 and mplab c30 code development systems are complete ansi c compilers for microchip?s pic18 family of microcontrollers and the dspic30, dspic33 and pic24 family of digital signal controllers. these compilers provide powerful integra- tion capabilities, superior code optimization and ease of use not found with other compilers. for easy source level debugging, the compilers provide symbol information that is optimized to the mplab ide debugger. 11.4 mplink object linker/ mplib object librarian the mplink object linker combines relocatable objects created by the mpasm assembler and the mplab c18 c compiler. it can link relocatable objects from precompiled libraries, using directives from a linker script. the mplib object librarian manages the creation and modification of library files of precompiled code. when a routine from a library is called from a source file, only the modules that contain that routine will be linked in with the application. this allows large libraries to be used efficiently in many different applications. the object linker/library features include: ? efficient linking of single libraries instead of many smaller files ? enhanced code maintainability by grouping related modules together ? flexible creation of libraries with easy module listing, replacement, deletion and extraction 11.5 mplab asm30 assembler, linker and librarian mplab asm30 assembler produces relocatable machine code from symbolic assembly language for dspic30f devices. mplab c30 c compiler uses the assembler to produce its object file. the assembler generates relocatable object files that can then be archived or linked with other relocatable object files and archives to create an executable file. notable features of the assembler include: ? support for the entire dspic30f instruction set ? support for fixed-point and floating-point data ? command line interface ? rich directive set ? flexible macro language ? mplab ide compatibility 11.6 mplab sim software simulator the mplab sim software simulator allows code development in a pc-hosted environment by simulat- ing the pic mcus and dspic ? dscs on an instruction level. on any given instruction, the data areas can be examined or modified and stimuli can be applied from a comprehensive stimulus controller. registers can be logged to files for further run-time analysis. the trace buffer and logic analyzer display extend the power of the simulator to record and track program execution, actions on i/o, most peripherals and internal registers. the mplab sim software simulator fully supports symbolic debugging using the mplab c18 and mplab c30 c compilers, and the mpasm and mplab asm30 assemblers. the software simulator offers the flexibility to develop and debug code outside of the hardware laboratory environment, making it an excellent, economical software development tool.
? 2006 microchip technology inc. ds40039d-page 81 PIC16F630/676 11.7 mplab ice 2000 high-performance in-circuit emulator the mplab ice 2000 in-circuit emulator is intended to provide the product development engineer with a complete microcontroller design tool set for pic microcontrollers. software control of the mplab ice 2000 in-circuit emulator is advanced by the mplab integrated development environment, which allows editing, building, downloading and source debugging from a single environment. the mplab ice 2000 is a full-featured emulator system with enhanced trace, trigger and data monitor- ing features. interchangeable processor modules allow the system to be easily reconfigured for emulation of different processors. the architecture of the mplab ice 2000 in-circuit emulator allows expansion to support new pic microcontrollers. the mplab ice 2000 in-circuit emulator system has been designed as a real-time emulation system with advanced features that are typically found on more expensive development tools. the pc platform and microsoft ? windows ? 32-bit operating system were chosen to best make these features available in a simple, unified application. 11.8 mplab ice 4000 high-performance in-circuit emulator the mplab ice 4000 in-circuit emulator is intended to provide the product development engineer with a complete microcontroller design tool set for high-end pic mcus and dspic dscs. software control of the mplab ice 4000 in-circuit emulator is provided by the mplab integrated development environment, which allows editing, building, downloading and source debugging from a single environment. the mplab ice 4000 is a premium emulator system, providing the features of mplab ice 2000, but with increased emulation memory and high-speed perfor- mance for dspic30f and pic18xxxx devices. its advanced emulator features include complex triggering and timing, and up to 2 mb of emulation memory. the mplab ice 4000 in-circuit emulator system has been designed as a real-time emulation system with advanced features that are typically found on more expensive development tools. the pc platform and microsoft windows 32-bit operating system were chosen to best make these features available in a simple, unified application. 11.9 mplab icd 2 in-circuit debugger microchip?s in-circuit debugger, mplab icd 2, is a powerful, low-cost, run-time development tool, connecting to the host pc via an rs-232 or high-speed usb interface. this tool is based on the flash pic mcus and can be used to develop for these and other pic mcus and dspic dscs. the mplab icd 2 utilizes the in-circuit debugging capability built into the flash devices. this feature, along with microchip?s in-circuit serial programming tm (icsp tm ) protocol, offers cost- effective, in-circuit flash debugging from the graphical user interface of the mplab integrated development environment. this enables a designer to develop and debug source code by setting breakpoints, single step- ping and watching variables, and cpu status and peripheral registers. running at full speed enables testing hardware and applications in real time. mplab icd 2 also serves as a development programmer for selected pic devices. 11.10 mplab pm3 device programmer the mplab pm3 device programmer is a universal, ce compliant device programmer with programmable voltage verification at v ddmin and v ddmax for maximum reliability. it features a large lcd display (128 x 64) for menus and error messages and a modu- lar, detachable socket assembly to support various package types. the icsp? cable assembly is included as a standard item. in stand-alone mode, the mplab pm3 device programmer can read, verify and program pic devices without a pc connection. it can also set code protection in this mode. the mplab pm3 connects to the host pc via an rs-232 or usb cable. the mplab pm3 has high-speed communications and optimized algorithms for quick programming of large memory devices and incorporates an sd/mmc card for file storage and secure data applications.
PIC16F630/676 ds40039d-page 82 ? 2006 microchip technology inc. 11.11 picstart plus development programmer the picstart plus development programmer is an easy-to-use, low-cost, prototype programmer. it connects to the pc via a com (rs-232) port. mplab integrated development environment software makes using the programmer simple and efficient. the picstart plus development programmer supports most pic devices in dip packages up to 40 pins. larger pin count devices, such as the pic16c92x and pic17c76x, may be supported with an adapter socket. the picstart plus development programmer is ce compliant. 11.12 pickit 2 development programmer the pickit? 2 development programmer is a low-cost programmer with an easy-to-use interface for pro- gramming many of microchip?s baseline, mid-range and pic18f families of flash memory microcontrollers. the pickit 2 starter kit includes a prototyping develop- ment board, twelve sequential lessons, software and hi-tech?s picc? lite c compiler, and is designed to help get up to speed quickly using pic ? micro- controllers. the kit provides everything needed to program, evaluate and develop applications using microchip?s powerful, mid-range flash memory family of microcontrollers. 11.13 demonstration, development and evaluation boards a wide variety of demonstration, development and evaluation boards for various pic mcus and dspic dscs allows quick application development on fully func- tional systems. most boards include prototyping areas for adding custom circuitry and provide application firmware and source code for examination and modification. the boards support a variety of features, including leds, temperature sensors, switches, speakers, rs-232 interfaces, lcd displays, potentiometers and additional eeprom memory. the demonstration and development boards can be used in teaching environments, for prototyping custom circuits and for learning about various microcontroller applications. in addition to the picdem? and dspicdem? demon- stration/development board series of circuits, microchip has a line of evaluation kits and demonstration software for analog filter design, k ee l oq ? security ics, can, irda ? , powersmart ? battery management, seeval ? evaluation system, sigma-delta adc, flow rate sensing, plus many more. check the microchip web page (www.microchip.com) and the latest ?product selector guide? (ds00148) for the complete list of demonstration, development and evaluation kits.
? 2006 microchip technology inc. ds40039d-page 83 PIC16F630/676 12.0 electrical specifications absolute maximum ratings? ambient temperature under bias................................................................................................. .......... -40 to +125c storage temperature ............................................................................................................ ............ -65c to +150c voltage on v dd with respect to v ss ..................................................................................................... -0.3 to +6.5v voltage on mclr with respect to vss ..................................................................................................-0.3 to +13.5v voltage on all other pins with respect to v ss ........................................................................... -0.3v to (v dd + 0.3v) total power dissipation (1) ............................................................................................................................... 800 mw maximum current out of v ss pin ..................................................................................................................... 300 ma maximum current into v dd pin ........................................................................................................................ 250 ma input clamp current, i ik (v i < 0 or v i > v dd ) ............................................................................................................... 20 ma output clamp current, i ok (vo < 0 or vo >v dd ) ......................................................................................................... 20 ma maximum output current sunk by any i/o pin..................................................................................... ............... 25 ma maximum output current sourced by any i/o pin .................................................................................. ............ 25 ma maximum current sunk by porta and portc (combined) .......................................................................... 200 ma maximum current sourced porta and portc (combined) .......................................................................... 200 ma note 1: power dissipation is calculated as follows: p dis = v dd x {i dd - i oh } + {(v dd -v oh ) x i oh } + (v o l x i ol ). ? notice : stresses above those listed under ?absolute maximum ratings? may cause permanent damage to the device. this is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operation listings of this specification is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. note: voltage spikes below v ss at the mclr pin, inducing currents greater than 80 ma, may cause latch-up. thus, a series resistor of 50-100 should be used when applying a "low" level to the mclr pin, rather than pulling this pin directly to v ss .
PIC16F630/676 ds40039d-page 84 ? 2006 microchip technology inc. figure 12-1: PIC16F630/676 with a/d disabled voltage-frequency graph, -40c t a +125c figure 12-2: pic16f676 with a/d e nabled voltage-frequency graph, -40c t a +125c 5.5 2.0 3.5 2.5 0 3.0 4.0 4.5 5.0 4 frequency (mhz) v dd (volts) note 1: the shaded region indicates the permissible combinations of voltage and frequency. 816 12 20 10 5.5 2.0 3.5 2.5 0 3.0 4.0 4.5 5.0 4 frequency (mhz) v dd (volts) note 1: the shaded region indicates the permissible combinations of voltage and frequency. 816 12 20 10
? 2006 microchip technology inc. ds40039d-page 85 PIC16F630/676 figure 12-3: pic16f676 with a/d enabled voltage-frequency graph, 0c t a +125c 5.5 2.0 3.5 2.5 0 3.0 4.0 4.5 5.0 4 frequency (mhz) v dd (volts) note 1: the shaded region indicates the permissible combinations of voltage and frequency. 816 12 20 10 2.2
PIC16F630/676 ds40039d-page 86 ? 2006 microchip technology inc. 12.1 dc characteristics: PIC16F630/676-i (industrial), PIC16F630/676-e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c t a +85c for industrial -40c t a +125c for extended param no. sym characteristic min typ? max units conditions d001 d001a d001b d001c d001d v dd supply voltage 2.0 2.2 2.5 3.0 4.5 ? ? ? ? ? 5.5 5.5 5.5 5.5 5.5 v v v v v f osc < = 4 mhz: PIC16F630/676 with a/d off pic16f676 with a/d on, 0c to +125c pic16f676 with a/d on, -40c to +125c 4 mh z < f osc < = 10 mhz d002 v dr ram data retention voltage (1) 1.5* ? ? v device in sleep mode d003 v por v dd start voltage to ensure internal power-on reset signal ?v ss ? v see section on power-on reset for details d004 s vdd v dd rise rate to ensure internal power-on reset signal 0.05* ? ? v/ms see section on power-on reset for details d005 v bod ?2.1? v * these parameters are characterized but not tested. ? data in "typ" column is at 5.0v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: this is the limit to which v dd can be lowered in sleep mode without losing ram data.
? 2006 microchip technology inc. ds40039d-page 87 PIC16F630/676 12.2 dc characteristics: PIC16F630/676-i (industrial) standard operating conditions (unless otherwise stated) operating temperature -40 c t a +85 c for industrial param no. device characteristics min typ? max units conditions v dd note d010 supply current (i dd ) ?916 a2.0f osc = 32 khz lp oscillator mode ?1828 a3.0 ?3554 a5.0 d011 ? 110 150 a2.0f osc = 1 mhz xt oscillator mode ? 190 280 a3.0 ? 330 450 a5.0 d012 ? 220 280 a2.0f osc = 4 mhz xt oscillator mode ? 370 650 a3.0 ? 0.6 1.4 ma 5.0 d013 ? 70 110 a2.0f osc = 1 mhz ec oscillator mode ? 140 250 a3.0 ? 260 390 a5.0 d014 ? 180 250 a2.0f osc = 4 mhz ec oscillator mode ? 320 470 a3.0 ? 580 850 a5.0 d015 ? 340 450 a2.0f osc = 4 mhz intosc mode ? 500 780 a3.0 ? 0.8 1.1 ma 5.0 d016 ? 180 250 a2.0f osc = 4 mhz extrc mode ? 320 450 a3.0 ? 580 800 a5.0 d017 ? 2.1 2.95 ma 4.5 f osc = 20 mhz hs oscillator mode ? 2.4 3.0 ma 5.0 ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the test conditions for all i dd measurements in active operation mode are: osc1 = external square wave, from rail to rail; all i/o pins tri-stated, pulled to v dd ; mclr = v dd ; wdt disabled. 2: the supply current is mainly a function of the operating voltage and frequency. other factors such as i/o pin loading and switching rate, oscillator type, internal code execution pattern, and temperature also have an impact on the current consumption.
PIC16F630/676 ds40039d-page 88 ? 2006 microchip technology inc. 12.3 dc characteristics: PIC16F630/676-i (industrial) standard operating conditions (unless otherwise stated) operating temperature -40 c t a +85 c for industrial param no. device characteristics min typ? max units conditions v dd note d020 power-down base current (i pd ) ? 0.99 700 na 2.0 wdt, bod, comparators, v ref , and t1osc disabled ? 1.2 770 na 3.0 ? 2.9 995 na 5.0 d021 ? 0.3 1.5 a 2.0 wdt current (1) ?1.83.5 a3.0 ?8.417 a5.0 d022 ? 58 70 a 3.0 bod current (1) ?109130 a5.0 d023 ? 3.3 6.5 a 2.0 comparator current (1) ?6.18.5 a3.0 ?11.516 a5.0 d024 ? 58 70 a2.0cv ref current (1) ?85100 a3.0 ?138160 a5.0 d025 ? 4.0 6.5 a 2.0 t1 o sc current (1) ?4.67.0 a3.0 ? 6.0 10.5 a5.0 d026 ? 1.2 755 na 3.0 a/d current (1) ? 0.0022 1.0 a5.0 ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the peripheral current is the sum of the base i dd or i pd and the additional current consumed when this peripheral is enabled. the peripheral current can be determined by subtracting the base i dd or i pd current from this limit. max values should be used when calculating total current consumption. 2: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in hi-impedance state and tied to v dd .
? 2006 microchip technology inc. ds40039d-page 89 PIC16F630/676 12.4 dc characteristics: PIC16F630/676-e (extended) standard operating conditions (unless otherwise stated) operating temperature -40 c t a +125 c for extended param no. device characteristics min typ? max units conditions v dd note d010e supply current (i dd ) ?916 a2.0f osc = 32 khz lp oscillator mode ?1828 a3.0 ?3554 a5.0 d011e ? 110 150 a2.0f osc = 1 mhz xt oscillator mode ? 190 280 a3.0 ? 330 450 a5.0 d012e ? 220 280 a2.0f osc = 4 mhz xt oscillator mode ? 370 650 a3.0 ? 0.6 1.4 ma 5.0 d013e ? 70 110 a2.0f osc = 1 mhz ec oscillator mode ? 140 250 a3.0 ? 260 390 a5.0 d014e ? 180 250 a2.0f osc = 4 mhz ec oscillator mode ? 320 470 a3.0 ? 580 850 a5.0 d015e ? 340 450 a2.0f osc = 4 mhz intosc mode ? 500 780 a3.0 ? 0.8 1.1 ma 5.0 d016e ? 180 250 a2.0f osc = 4 mhz extrc mode ? 320 450 a3.0 ? 580 800 a5.0 d017e ? 2.1 2.95 ma 4.5 f osc = 20 mhz hs oscillator mode ? 2.4 3.0 ma 5.0 ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the test conditions for all i dd measurements in active operation mode are: osc1 = external square wave, from rail to rail; all i/o pins tri-stated, pulled to v dd ; mclr = v dd ; wdt disabled. 2: the supply current is mainly a function of the operating voltage and frequency. other factors such as i/o pin loading and switching rate, oscillator type, internal code execution pattern, and temperature also have an impact on the current consumption.
PIC16F630/676 ds40039d-page 90 ? 2006 microchip technology inc. 12.5 dc characteristics: PIC16F630/676-e (extended) standard operating conditions (unless otherwise stated) operating temperature -40 c t a +125 c for extended param no. device characteristics min typ? max units conditions v dd note d020e power-down base current (i pd ) ? 0.00099 3.5 a 2.0 wdt, bod, comparators, v ref , and t1osc disabled ? 0.0012 4.0 a3.0 ? 0.0029 8.0 a5.0 d021e ? 0.3 6.0 a 2.0 wdt current (1) ?1.89.0 a3.0 ?8.420 a5.0 d022e ? 58 70 a 3.0 bod current (1) ?109130 a5.0 d023e ? 3.3 10 a 2.0 comparator current (1) ?6.113 a3.0 ?11.524 a5.0 d024e ? 58 70 a2.0cv ref current (1) ?85100 a3.0 ?138165 a5.0 d025e ? 4.0 10 a2.0t1 o sc current (1) ?4.612 a3.0 ?6.020 a5.0 d026e ? 0.0012 6.0 a 3.0 a/d current (1) ? 0.0022 8.5 a5.0 ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the peripheral current is the sum of the base i dd or i pd and the additional current consumed when this peripheral is enabled. the peripheral current can be determined by subtracting the base i dd or i pd current from this limit. max values should be used when calculating total current consumption. 2: the power-down current in sleep mode does not depend on the oscillator type. power-down current is measured with the part in sleep mode, with all i/o pins in hi-impedance state and tied to v dd .
? 2006 microchip technology inc. ds40039d-page 91 PIC16F630/676 12.6 dc characteristics: PIC16F630/676-i (industrial), PIC16F630/676-e (extended) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c t a +85c for industrial -40c t a +125c for extended param no. sym characteristic min typ? max units conditions input low voltage v il i/o ports d030 with ttl buffer v ss ? 0.8 v 4.5v v dd 5.5v d030a v ss ? 0.15 v dd votherwise d031 with schmitt trigger buffer v ss ? 0.2 v dd v entire range d032 mclr , osc1 (rc mode) v ss ? 0.2 v dd v d033 osc1 (xt and lp modes) v ss ? 0.3 v (note 1) d033a osc1 (hs mode) v ss ? 0.3 v dd v (note 1) input high voltage v ih i/o ports ? d040 d040a with ttl buffer 2.0 (0.25 v dd + 0.8) ? ? v dd v dd v v 4.5v v dd 5.5v otherwise d041 with schmitt trigger buffer 0.8 v dd ? v dd entire range d042 mclr 0.8 v dd ? v dd v d043 osc1 (xt and lp modes) 1.6 ? v dd v (note 1) d043a osc1 (hs mode) 0.7 v dd ? v dd v (note 1) d043b osc1 (rc mode) 0.9 v dd ? v dd v d070 i pur porta weak pull-up current 50* 250 400* av dd = 5.0v, v pin = v ss input leakage current (3) d060 i il i/o ports ? 0 . 1 1 av ss v pin v dd , pin at hi-impedance d060a analog inputs ? 0 . 1 1 av ss v pin v dd d060b v ref ? 0 . 1 1 av ss v pin v dd d061 mclr (2) ? 0 . 1 5 av ss v pin v dd d063 osc1 ? 0 . 1 5 av ss v pin v dd , xt, hs and lp osc configuration output low voltage d080 v ol i/o ports ?? 0.6 v i ol = 8.5 ma, v dd = 4.5v (ind.) d083 osc2/clkout (rc mode) ?? 0.6 v i ol = 1.6 ma, v dd = 4.5v (ind.) i ol = 1.2 ma, v dd = 4.5v (ext.) output high voltage d090 v oh i/o ports v dd - 0.7 ?? vi oh = -3.0 ma, v dd = 4.5v (ind.) d092 osc2/clkout (rc mode) v dd - 0.7 ?? vi oh = -1.3 ma, v dd = 4.5v (ind.) i oh = -1.0 ma, v dd = 4.5v (ext.) * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: in rc oscillator configuration, the osc1/clkin pin is a schmitt trigger input. it is not recommended to use an external clock in rc mode. 2: the leakage current on the mclr pin is strongly dependent on the applied voltage level. the specified levels represent normal operating conditions. higher leakage cu rrent may be measured at different input voltages. 3: negative current is defined as current sourced by the pin.
PIC16F630/676 ds40039d-page 92 ? 2006 microchip technology inc. 12.7 dc characteristics: PIC16F630/676-i (i ndustrial), pic 16f630/676-e (extended) (cont.) dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40c t a +85c for industrial -40c t a +125c for extended param no. sym characteristic min typ? max units conditions capacitive loading specs on output pins d100 c osc2 osc2 pin ? ? 15* pf in xt, hs and lp modes when external clock is used to drive osc1 d101 c io all i/o pins ? ? 50* pf data eeprom memory d120 e d byte endurance 100k 1m ? e/w -40 c t a +85c d120a e d byte endurance 10k 100k ? e/w +85c t a +125c d121 v drw v dd for read/write v min ? 5.5 v using eecon to read/write v min = minimum operating voltage d122 t dew erase/write cycle time ? 5 6 ms d123 t retd characteristic retention 40 ? ? year provided no other specifications are violated d124 t ref number of total erase/write cycles before refresh (1) 1m 10m ? e/w -40 c t a +85c program flash memory d130 e p cell endurance 10k 100k ? e/w -40 c t a +85c d130a e d cell endurance 1k 10k ? e/w +85c t a +125c d131 v pr v dd for read v min ?5.5vv min = minimum operating voltage d132 v pew v dd for erase/write 4.5 ? 5.5 v d133 t pew erase/write cycle time ? 2 2.5 ms d134 t retd characteristic retention 40 ? ? year provided no other specifications are violated * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: see section 8.5.1 for additional information.
? 2006 microchip technology inc. ds40039d-page 93 PIC16F630/676 12.8 timing parameter symbology the timing parameter symbols have been created with one of the following formats: figure 12-4: load conditions 1. tpps2pps 2. tpps t f frequency t time lowercase letters (pp) and their meanings: pp cc ccp1 osc osc1 ck clkout rd rd cs cs rw rd or wr di sdi sc sck do sdo ss ss dt data in t0 t0cki io i/o port t1 t1cki mc mclr wr wr uppercase letters and their meanings: s ffall pperiod hhigh rrise i invalid (hi-impedance) v valid l low z hi-impedance v dd /2 c l r l pin pin v ss v ss c l r l =464 c l = 50 pf for all pins 15 pf for osc2 output load condition 1 load condition 2
PIC16F630/676 ds40039d-page 94 ? 2006 microchip technology inc. 12.9 ac characteristics: PIC16F630/676 (industrial, extended) figure 12-5: external clock timing table 12-1: external clock timing requirements param no. sym characteristic min typ? max units conditions f osc external clkin frequency (1) dc ? 37 khz lp osc mode dc ? 4 mhz xt mode dc ? 20 mhz hs mode dc ? 20 mhz ec mode oscillator frequency (1) 5 ? 37 khz lp osc mode ?4 ?mhzintosc mode dc ? 4 mhz rc osc mode 0.1 ? 4 mhz xt osc mode 1? 20mhzhs osc mode 1t osc external clkin period (1) 27 ? ? slp osc mode 50 ? ns hs osc mode 50 ? ns ec osc mode 250 ? ns xt osc mode oscillator period (1) 27 200 slp osc mode ?250 ? nsintosc mode 250 ? ? ns rc osc mode 250 ? 10,000 ns xt osc mode 50 ? 1,000 ns hs osc mode 2t cy instruction cycle time (1) 200 t cy dc ns t cy = 4/f osc 3 tosl, to sh external clkin (osc1) high external clkin low 2* ? ? s lp oscillator, t osc l/h duty cycle 20* ? ? ns hs oscillator, t osc l/h duty cycle 100 * ? ? ns xt oscillator, t osc l/h duty cycle 4tosr, to sf external clkin rise external clkin fall ? ? 50* ns lp oscillator ? ? 25* ns xt oscillator ? ? 15* ns hs oscillator * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: instruction cycle period (t cy ) equals four times the input oscillator time-base period. all specified values are based on characterization data for that particular oscillator type under standard operating conditions with the device executing code. exceeding these specified limits may result in an unstable oscillator operation and/or higher than expected current consumption. all devices are tested to operate at ?min? values with an external clock applied to osc1 pin. when an external clock input is used, the ?max? cycle time limit is ?dc? (no clock) for all devices. osc1 clkout q4 q1 q2 q3 q4 q1 1 2 3 3 4 4
? 2006 microchip technology inc. ds40039d-page 95 PIC16F630/676 table 12-2: precision internal oscillator parameters param no. sym characteristic freq tolerance min typ? max units conditions f10 f osc internal calibrated intosc frequency 1 3.96 4.00 4.04 mhz v dd = 3.5v, 25 c 2 3.92 4.00 4.08 mhz 2.5v v dd 5.5v 0 c t a +85 c 5 3.80 4.00 4.20 mhz 2.0v v dd 5.5v -40 c t a +85 c (ind) -40 c t a +125 c (ext) f14 t iosc st oscillator wake-up from sleep start-up time* ??6 8 sv dd = 2.0v, -40 c to +85 c ??4 6 sv dd = 3.0v, -40 c to +85 c ??3 5 sv dd = 5.0v, -40 c to +85 c * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested.
PIC16F630/676 ds40039d-page 96 ? 2006 microchip technology inc. figure 12-6: clkout and i/o timing table 12-3: clkout and i/o timing requirements osc1 clkout i/o pin (input) i/o pin (output) q4 q1 q2 q3 10 13 14 17 20, 21 22 23 19 18 15 11 12 16 old value new value param no. sym characteristic min typ? max units conditions 10 tosh2ckl osc1 to clout ? 75 200 ns (note 1) 11 tosh2ckh osc1 to clout ? 75 200 ns (note 1) 12 tckr clkout rise time ? 35 100 ns (note 1) 13 tckf clkout fall time ? 35 100 ns (note 1) 14 tckl2iov clkout to port out valid ? ? 20 ns (note 1) 15 tiov2ckh port in valid before clkout t osc + 200 ns ? ? ns (note 1) 16 tckh2ioi port in hold after clkout 0 ? ? ns (note 1) 17 tosh2iov osc1 (q1 cycle) to port out valid ? 50 150 * ns ? ? 300 ns 18 tosh2ioi osc1 (q2 cycle) to port input invalid (i/o in hold time) 100 ? ? ns 19 tiov2osh port input valid to osc1 (i/o in setup time) 0??ns 20 tior port output rise time ? 10 40 ns 21 tiof port output fall time ? 10 40 ns 22 tinp int pin high or low time 25 ? ? ns 23 trbp porta change int high or low time t cy ??ns * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. note 1: measurements are taken in rc mode where clkout output is 4xt osc .
? 2006 microchip technology inc. ds40039d-page 97 PIC16F630/676 figure 12-7: reset, watchdog timer, oscillator start-up timer and power-up timer timing figure 12-8: brown-out detect timing and characteristics v dd mclr internal por pwrt time-out osc time-out internal reset watchdog timer reset 33 32 30 31 34 i/o pins 34 b vdd reset (due to bod) v dd (device in brown-out detect) (device not in brown-out detect) 72 ms time-out (1) 35 note 1: 72 ms delay only if pwrte bit in configuration word is programmed to ?0?.
PIC16F630/676 ds40039d-page 98 ? 2006 microchip technology inc. table 12-4: reset, watchdog timer, oscillator start-up timer, power-up timer, and brown-out detect requirements param no. sym characteristic min typ? max units conditions 30 t mc l mclr pulse width (low) 2 11 ? 18 ? 24 s ms v dd = 5v, -40c to +85c extended temperature 31 t wdt watchdog timer time-out period (no prescaler) 10 10 17 17 25 30 ms ms v dd = 5v, -40c to +85c extended temperature 32 t ost oscillation start-up timer period ? 1024t osc ??t osc = osc1 period 33* t pwrt power-up timer period 28* tbd 72 tbd 132* tbd ms ms v dd = 5v, -40c to +85c extended temperature 34 t ioz i/o hi-impedance from mclr low or watchdog timer reset ??2.0 s b vdd brown-out detect voltage 2.025 ? 2.175 v brown-out hysteresis tbd ? ? ? 35 t bod brown-out detect pulse width 100* ? ? sv dd b vdd (d005) * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested.
? 2006 microchip technology inc. ds40039d-page 99 PIC16F630/676 figure 12-9: timer0 and timer1 external clock timings table 12-5: timer0 and timer1 external clock requirements t0cki t1cki 40 41 42 45 46 47 48 tmr0 or tmr1 param no. sym characteristic min typ? max units conditions 40* tt0h t0cki high pulse width no prescaler 0.5 t cy + 20 ? ? ns with prescaler 10 ? ? ns 41* tt0l t0cki low pulse width no prescaler 0.5 t cy + 20 ? ? ns with prescaler 10 ? ? ns 42* tt0p t0cki period greater of: 20 or t cy + 40 n ? ? ns n = prescale value (2, 4, ..., 256) 45* tt1h t1cki high time synchronous, no prescaler 0.5 t cy + 20 ? ? ns synchronous, with prescaler 15 ? ? ns asynchronous 30 ? ? ns 46* tt1l t1cki low time synchronous, no prescaler 0.5 t cy + 20 ? ? ns synchronous, with prescaler 15 ? ? ns asynchronous 30 ? ? ns 47* tt1p t1cki input period synchronous greater of: 30 or t cy + 40 n ? ? ns n = prescale value (1, 2, 4, 8) asynchronous 60 ? ? ns ft1 timer1 oscillator input frequency range (oscillator enabled by setting bit t1oscen) dc ? 200* khz 48 tckeztmr1 delay from external clock edge to timer increment 2 t osc *?7 t osc *? * these parameters are characterized but not tested. ? data in ?typ? column is at 5v, 25c unless otherwise stated. these parameters are for design guidance only and are not tested.
PIC16F630/676 ds40039d-page 100 ? 2006 microchip technology inc. table 12-6: comparator specifications table 12-7: comparator voltage reference specifications comparator specifications standard operating conditions -40c to +125c (unless otherwise stated) sym characteristics min typ max units comments v os input offset voltage ? 5.0 10 mv v cm input common mode voltage 0 ? v dd - 1.5 v c mrr common mode rejection ratio +55* ? ? db t rt response time (1) ? 150 400* ns t mc 2 co v comparator mode change to output valid ?? 10* s * these parameters are characterized but not tested. note 1: response time measured with one comparator input at (v dd - 1.5)/2 while the other input transitions from v ss to v dd - 1.5v. voltage reference specifications standard operating conditions -40c to +125c (unless otherwise stated) sym characteristics min typ max units comments resolution ? ? v dd /24* v dd /32 ? ? lsb lsb low range (vrr = 1) high range (vrr = 0) absolute accuracy ? ? ? ? 1/2* 1/2* lsb lsb low range (vrr = 1) high range (vrr = 0) unit resistor value (r) ? 2k* ? settling time (1) ?? 10* s * these parameters are characterized but not tested. note 1: settling time measured while vrr = 1 and vr<3:0> transitions from 0000 to 1111 .
? 2006 microchip technology inc. ds40039d-page 101 PIC16F630/676 table 12-8: pic16f676 a/d converter characteristics : param no. sym characteristic min typ? max units conditions a01 n r resolution ? ? 10 bits bit a02 e abs total absolute error* ?? 1lsbv ref = 5.0v a03 e il integral error ? ? 1lsbv ref = 5.0v a04 e dl differential error ? ? 1 lsb no missing codes to 10 bits v ref = 5.0v a05 e fs full scale range 2.2* ? 5.5* v a06 e off offset error ? ? 1lsbv ref = 5.0v a07 e gn gain error ? ? 1lsbv ref = 5.0v a10 ? monotonicity ? guaranteed (3) ??v ss v ain v ref + a20 a20a v ref reference voltage 2.0 2.5 ?? v dd + 0.3 v absolute minimum to ensure 10-bit accuracy a21 v ref reference v high (v dd or v ref ) v ss ?v dd v a25 v ain analog input voltage v ss ?v ref v a30 z ain recommended impedance of analog voltage source ?? 10k a50 i ref v ref input current (2) 10 ? ? ? 1000 10 a a during v ain acquisition. based on differential of v hold to v ain . during a/d conversion cycle. * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: when a/d is off, it will not consume any current other than leakage current. the power-down current spec includes any such leakage from the a/d module. 2: v ref current is from external v ref or v dd pin, whichever is selected as reference input. 3: the a/d conversion result never decreases with an increase in the input voltage and has no missing codes.
PIC16F630/676 ds40039d-page 102 ? 2006 microchip technology inc. figure 12-10: pic16f676 a/d conversion timing (normal mode) table 12-9: pic16f676 a/d conversion requirements 131 130 132 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped done new_data 987 3210 note 1: if the a/d clock source is selected as rc, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. 1 t cy 6 134 (t osc /2) (1) 1 t cy param no. sym characteristic min typ? max units conditions 130 t ad a/d clock period 1.6 ? ? st osc based, v ref 3.0v 3.0* ? ? st osc based, v ref full range 130 t ad a/d internal rc oscillator period 3.0* 6.0 9.0* s adcs<1:0> = 11 (rc mode) at v dd = 2.5v 2.0* 4.0 6.0* sat v dd = 5.0v 131 t cnv conversion time (not including acquisition time) (1) ?11?t ad set go bit to new data in a/d result register 132 t acq acquisition time (note 2) 5* 11.5 ? ? ? s s the minimum time is the amplifier settling time. this may be used if the ?new? input voltage has not changed by more than 1 lsb (i.e., 4.1 mv @ 4.096v) from the last sampled volt- age (as stored on c hold ). 134 t go q4 to a/d clock start ?t osc /2 ? ? if the a/d clock source is selected as rc, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: adres register may be read on the following t cy cycle. 2: see table 7-1 for minimum conditions.
? 2006 microchip technology inc. ds40039d-page 103 PIC16F630/676 figure 12-11: pic16f676 a/d conversion timing (sleep mode) table 12-10: pic16f676 a/d conversion requirements (sleep mode) param no. sym characteristic min typ? max units conditions 130 t ad a/d clock period 1.6 ? ? sv ref 3.0v 3.0* ? ? sv ref full range 130 t ad a/d internal rc oscillator period 3.0* 6.0 9.0* s adcs<1:0> = 11 (rc mode) at v dd = 2.5v 2.0* 4.0 6.0* sat v dd = 5.0v 131 t cnv conversion time (not including acquisition time) (1) ?11?t ad 132 t acq acquisition time (note 2) 5* 11.5 ? ? ? s s the minimum time is the amplifier settling time. this may be used if the ?new? input voltage has not changed by more than 1 lsb (i.e., 4.1 mv @ 4.096v) from the last sampled voltage (as stored on c hold ). 134 t go q4 to a/d clock start ?t osc /2 + t cy ? ? if the a/d clock source is selected as rc, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. * these parameters are characterized but not tested. ? data in ?typ? column is at 5.0v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: adres register may be read on the following t cy cycle. 2: see table 7-1 for minimum conditions. 131 130 bsf adcon0, go q4 a/d clk a/d data adres adif go sample old_data sampling stopped done new_data 9 7 3210 note 1: if the a/d clock source is selected as rc, a time of t cy is added before the a/d clock starts. this allows the sleep instruction to be executed. 134 6 8 132 1 t cy (t osc /2 + t cy ) (1) 1 t cy
PIC16F630/676 ds40039d-page 104 ? 2006 microchip technology inc. notes:
? 2006 microchip technology inc. ds40039d-page 105 PIC16F630/676 13.0 dc and ac characteristics graphs and tables the graphs and tables provided in this section are for design guidance and are not tested . in some graphs or tables, the data presented are outside specified operating range (i.e., outside specified v dd range). this is for information only and devices are ensured to operate properly only within the specified range. the data presented in this section is a statistical summary of data collected on units from different lots over a period of time and matrix samples. 'typical' represents the mean of the distribution at 25c. 'max' or 'min' represents (mean + 3 ) or (mean - 3 ) respectively, where is standard deviation, over the whole temperature range. figure 13-1: typical i pd vs. v dd over temp (-40c to +25c) figure 13-2: typical i pd vs. v dd over temp (+85c) typical baseline i pd 0.0e+00 1.0e-09 2.0e-09 3.0e-09 4.0e-09 5.0e-09 6.0e-09 2 2.5 3 3.5 4 4.5 5 5.5 v dd (v) i pd (a) -40 0 25 typical baseline i pd 0.0e+00 5.0e-08 1.0e-07 1.5e-07 2.0e-07 2.5e-07 3.0e-07 3.5e-07 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i pd (a) 85
PIC16F630/676 ds40039d-page 106 ? 2006 microchip technology inc. figure 13-3: typical i pd vs. v dd over temp (+125c) figure 13-4: maximum i pd vs. v dd over temp (-40c to +25c) typical baseline i pd 0.0e+00 5.0e-07 1.0e-06 1.5e-06 2.0e-06 2.5e-06 3.0e-06 3.5e-06 4.0e-06 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i pd (a) 125 maximum baseline i pd 0.0e+00 1.0e-08 2.0e-08 3.0e-08 4.0e-08 5.0e-08 6.0e-08 7.0e-08 8.0e-08 9.0e-08 1.0e-07 22.533.544.555.5 v dd (v) i pd (a) -40 0 25
? 2006 microchip technology inc. ds40039d-page 107 PIC16F630/676 figure 13-5: maximum i pd vs. v dd over temp (+85c) figure 13-6: maximum i pd vs. v dd over temp (+125c) maximum baseline i pd 0.0e+00 1.0e-07 2.0e-07 3.0e-07 4.0e-07 5.0e-07 6.0e-07 7.0e-07 8.0e-07 9.0e-07 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i pd (a) 85 maximum baseline i pd 0.0e+00 1.0e-06 2.0e-06 3.0e-06 4.0e-06 5.0e-06 6.0e-06 7.0e-06 8.0e-06 9.0e-06 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i pd (a) 125
PIC16F630/676 ds40039d-page 108 ? 2006 microchip technology inc. figure 13-7: typical i pd with bod enabled vs. v dd over temp (-40c to +125c) figure 13-8: typical i pd with cmp enabled vs. v dd over temp (-40c to +125c) typical bod i pd 50 60 70 80 90 100 110 120 130 3 3.5 4 4.5 5 5.5 v dd (v) i pd (ua) -40 0 25 85 125 typical comparator i pd 0.0e+00 2.0e-06 4.0e-06 6.0e-06 8.0e-06 1.0e-05 1.2e-05 1.4e-05 1.6e-05 1.8e-05 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i pd (a) -40 0 25 85 125
? 2006 microchip technology inc. ds40039d-page 109 PIC16F630/676 figure 13-9: typical i pd with a/d enabled vs. v dd over temp (-40c to +25c) figure 13-10: typical i pd with a/d enabled vs. v dd over temp (+85c) typical a/d i pd 0.0e+00 5.0e-10 1.0e-09 1.5e-09 2.0e-09 2.5e-09 3.0e-09 3.5e-09 4.0e-09 4.5e-09 5.0e-09 2 2.5 3 3.5 4 4.5 5 5.5 v dd (v) i pd (a) -40 0 25 typical a/d i pd 0.0e+00 5.0e-08 1.0e-07 1.5e-07 2.0e-07 2.5e-07 3.0e-07 3.5e-07 2 2.5 3 3.5 4 4.5 5 5.5 v dd (v) i pd (a) 85
PIC16F630/676 ds40039d-page 110 ? 2006 microchip technology inc. figure 13-11: typical i pd with a/d enabled vs. v dd over temp (+125c) figure 13-12: typical i pd with t1 osc enabled vs. v dd over temp (-40c to +125c), 32 khz, c1 and c2=50 pf) typical a/d i pd 0.0e+00 5.0e-07 1.0e-06 1.5e-06 2.0e-06 2.5e-06 3.0e-06 3.5e-06 22.533.544.555.5 v dd (v) i pd (a) 125 typical t1 i pd 0.00e+00 2.00e-06 4.00e-06 6.00e-06 8.00e-06 1.00e-05 1.20e-05 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 v dd (v) i pd (a) -40 0 25 85 125
? 2006 microchip technology inc. ds40039d-page 111 PIC16F630/676 figure 13-13: typical i pd with cv ref enabled vs. v dd over temp (-40c to +125c) figure 13-14: typical i pd with wdt enabled vs. v dd over temp (-40c to +125c) typical cv ref i pd 40 60 80 100 120 140 160 2 2.5 3 3.5 4 4.5 5 5.5 v dd (v) i pd (ua) -40 0 25 85 125 typical wdt i pd 0 2 4 6 8 10 12 14 16 2 2.5 3 3.5 4 4.5 5 5.5 v dd (v) i pd (ua) -40 0 25 85 125
PIC16F630/676 ds40039d-page 112 ? 2006 microchip technology inc. figure 13-15: maximum and minimum intosc freq vs. temperature with 0.1 f and 0.01 f decoupling (v dd = 3.5v) figure 13-16: maximum and minimum intosc freq vs. v dd with 0.1 f and 0.01 f decoupling (+25c) internal oscillator frequency vs temperature 3.80e+06 3.85e+06 3.90e+06 3.95e+06 4.00e+06 4.05e+06 4.10e+06 4.15e+06 4.20e+06 -40c 0c 25c 85c 125c temperature (c) frequency (hz) -3sigma average +3sigma internal oscillator frequency vs v dd 3.80e+06 3.85e+06 3.90e+06 3.95e+06 4.00e+06 4.05e+06 4.10e+06 4.15e+06 4.20e+06 2.0v 2.5v 3.0v 3.5v 4.0v 4.5v 5.0v 5.5v v dd (v) frequency (hz) -3sigma average +3sigma
? 2006 microchip technology inc. ds40039d-page 113 PIC16F630/676 figure 13-17: typical wdt period vs. v dd (-40 c to +125 c) wdt time-out 0 5 10 15 20 25 30 35 40 45 50 2 2.5 3 3.5 4 4.5 5 5.5 v dd (v) time ( ms) -40 0 25 85 125
PIC16F630/676 ds40039d-page 114 ? 2006 microchip technology inc. notes:
? 2006 microchip technology inc. ds40039d-page 115 PIC16F630/676 14.0 packaging information 14.1 package marking information xxxxxxxxxxxxxx 14-lead pdip (skinny dip) example xxxxxxxxxxxxxx yywwnnn 16f630-i 0215/017 xxxxxxxxxxx 14-lead soic xxxxxxxxxxx yywwnnn example 16f630-e 0215/017 14-lead tssop nnn xxxxxxxx yyww example 017 16f630 0215 legend: xx...x customer-specific information y year code (last digit of calendar year) yy year code (last 2 digits of calendar year) ww week code (week of january 1 is week ?01?) nnn alphanumeric traceability code pb-free jedec designator for matte tin (sn) * this package is pb-free. the pb-free jedec designator ( ) can be found on the outer packaging for this package. note : in the event the full microchip part number cannot be marked on one line, it will be carried over to the next line, thus limiting the number of available characters for customer-specific information. 3 e 3 e 3 e 3 e 3 e
PIC16F630/676 ds40039d-page 116 ? 2006 microchip technology inc. 14.2 package details the following sections give the technical details of the packages. 14-lead plastic dual in-line (p) ? 300 mil (pdip) note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging e1 n d 1 2 eb e c a a1 b b1 l a2 p units inches * millimeters dimension limits min nom max min nom max number of pins n 14 14 pitch p .100 2.54 top to seating plane a .140 .155 .170 3.56 3.94 4.32 molded package thickness a2 .115 .130 .145 2.92 3.30 3.68 base to seating plane a1 .015 0.38 shoulder to shoulder width e .300 .313 .325 7.62 7.94 8.26 molded package width e1 .240 .250 .260 6.10 6.35 6.60 overall length d .740 .750 .760 18.80 19.05 19.30 tip to seating plane l .125 .130 .135 3.18 3.30 3.43 lead thickness c .008 .012 .015 0.20 0.29 0.38 upper lead width b1 .045 .058 .070 1.14 1.46 1.78 lower lead width b .014 .018 .022 0.36 0.46 0.56 overall row spacing eb .310 .370 .430 7.87 9.40 10.92 mold draft angle top 51015 51015 51015 51015 mold draft angle bottom * controlling parameter notes: dimensions d and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed .010? (0.254mm) per si de. jedec equivalent: ms-001 drawing no. c04-005 significant characteristic
? 2006 microchip technology inc. ds40039d-page 117 PIC16F630/676 14-lead plastic small outline (sl) ? narrow, 150 mil (soic) note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging foot angle 048048 15 12 0 15 12 0 mold draft angle bottom 15 12 0 15 12 0 mold draft angle top 0.51 0.42 0.36 .020 .017 .014 b lead width 0.25 0.23 0.20 .010 .009 .008 c lead thickness 1.27 0.84 0.41 .050 .033 .016 l foot length 0.51 0.38 0.25 .020 .015 .010 h chamfer distance 8.81 8.69 8.56 .347 .342 .337 d overall length 3.99 3.90 3.81 .157 .154 .150 e1 molded package width 6.20 5.99 5.79 .244 .236 .228 e overall width 0.25 0.18 0.10 .010 .007 .004 a1 standoff 1.55 1.42 1.32 .061 .056 .052 a2 molded package thickness 1.75 1.55 1.35 .069 .061 .053 a overall height 1.27 .050 p pitch 14 14 n number of pins max nom min max nom min dimension limits millimeters inches * units 2 1 d p n b e e1 h l c 45 a2 a a1 * controlling parameter notes: dimensions d and e1 do not include mold flash or protrusions. mold flash or protrusions shall not exceed .010? (0.254mm) per si de. jedec equivalent: ms-012 drawing no. c04-065 revised 7-20-06 significant characteristic
PIC16F630/676 ds40039d-page 118 ? 2006 microchip technology inc. 14-lead plastic thin shrink small outline (st) ? 4.4 mm (tssop) note: for the most current package drawings, please see the microchip packaging specification located at http://www.microchip.com/packaging l c 2 1 d n b p e1 e a2 a1 a 8 4 0 8 4 0 foot angle mold draft angle bottom 12 ref mold draft angle top 0.30 0.25 0.19 .012 .010 .007 b lead width 0.20 0.15 0.09 .008 .006 .004 c lead thickness 0.70 0.60 0.50 .028 .024 .020 l foot length 5.10 5.00 4.90 .201 .197 .193 d molded package length 4.50 4.40 4.30 .177 .173 .169 e1 molded package width 6.50 6.38 6.25 .256 .251 .246 e overall width 0.15 0.10 0.05 .006 .004 .002 a1 standoff 0.95 0.90 0.85 .037 .035 .033 a2 molded package thickness 1.10 1.05 1.00 .043 .041 .039 a overall height 0.65 bsc .026 bsc p pitch 14 14 n number of pins max nom min max nom min dimension limits millimeters * inches units dimensions d and e1 do not include mold fla sh or protrusions. mold flash or protrusions shall not exceed .005" (0.127mm) per s ide. notes: jedec equivalent: mo-153 ab-1 revised: 08-17-05 * controlling parameter bsc: basic dimension. theoretically exact value shown without tolerances. ref: reference dimension, usually without tole rance, for information purposes only. see asme y14.5m see asme y14.5m drawing no. c04-087 12 ref 12 ref 12 ref
? 2006 microchip technology inc. ds40039d-page 119 PIC16F630/676 appendix a: data sheet revision history revision a this is a new data sheet. revision b added characterization graphs. updated specifications. added notes to indicate microchip programmers maintain all calibration bits to factory settings and the pic16f676 ansel register must be initialized to configure pins as digital i/o. revision c revision d updated package drawings; replaced picmicro with pic. appendix b: device differences the differences between the PIC16F630/676 devices listed in this data sheet are shown in table b-1. table b-1: device differences feature PIC16F630 pic16f676 a/d no yes
PIC16F630/676 ds40039d-page 120 ? 2006 microchip technology inc. appendix c: device migrations this section is intended to describe the functional and electrical specification differences when migrating between functionally similar devices (such as from a pic16c74a to a pic16c74b). not applicable appendix d: migrating from other pic ? devices this discusses some of the issues in migrating from other pic devices to the pic16f6xx family of devices. d.1 pic12c67x to pic12f6xx table 1: feature comparison feature pic12c67x pic16f6xx max operating speed 10 mhz 20 mhz max program memory 2048 bytes 1024 bytes a/d resolution 8-bit 10-bit data eeprom 16 bytes 64 bytes oscillator modes 5 8 brown-out detect n y internal pull-ups ra0/1/3 ra0/1/2/4/5 interrupt-on-change ra0/1/3 ra0/1/2/3/4/5 comparator n y note: this device has been designed to perform to the parameters of its data sheet. it has been tested to an electrical specification designed to determine its conformance with these parameters. due to process differences in the manufacture of this device, this device may have different performance characteristics than its earlier version. these differences may cause this device to perform differently in your application than the earlier version of this device.
? 2006 microchip technology inc. ds40039d-page 121 PIC16F630/676 index a a/d ...................................................................................... 43 acquisition requirements ........................................... 47 block diagram............................................................. 43 calculating acquisition time....................................... 47 configuration and operation....................................... 43 effects of a reset ..................................................... 48 internal sampling switch (rss) impedance ................ 47 operation during sleep ............................................ 48 pic16f675 converter characteristics ...................... 101 source impedance...................................................... 47 summary of registers ................................................ 48 absolute maximum ratings ................................................ 83 ac characteristics industrial and extended .............................................. 94 analog input connection considerations............................ 40 analog-to-digital converter. see a/d assembler mpasm assembler..................................................... 80 b block diagram tmr0/wdt prescaler................................................. 29 block diagrams analog input mode...................................................... 40 analog input model ..................................................... 47 comparator output ..................................................... 40 comparator voltage reference .................................. 41 on-chip reset circuit ................................................. 57 ra0 and ra1 pins ...................................................... 22 ra2 ............................................................................. 23 ra3 ............................................................................. 23 ra4 ............................................................................. 24 ra5 ............................................................................. 24 rc oscillator mode..................................................... 56 rc0/rc1/rc2/rc3 pins ............................................ 26 rc4 and rc5 pins .................................................... 26 timer1......................................................................... 32 watchdog timer.......................................................... 67 brown-out associated registers .................................................. 60 brown-out detect (bod) ..................................................... 59 brown-out detect timing and characteristics..................... 97 c c compilers mplab c18 ................................................................ 80 mplab c30 ................................................................ 80 calibrated internal rc frequencies.................................... 95 clkout ............................................................................. 56 code examples changing prescaler .................................................... 31 data eeprom read .................................................. 51 data eeprom write .................................................. 51 initializing porta....................................................... 19 initializing portc....................................................... 26 saving status and w registers in ram ................. 66 write verify ................................................................. 51 code protection .................................................................. 69 comparator ......................................................................... 37 associated registers .................................................. 42 configuration............................................................... 39 effects of a reset ..................................................... 41 i/o operating modes................................................... 39 interrupts..................................................................... 42 operation .................................................................... 38 operation during sleep............................................ 41 output......................................................................... 40 reference ................................................................... 41 response time .......................................................... 41 comparator specifications................................................ 100 comparator voltage reference specifications................. 100 configuration bits ............................................................... 54 configuring the voltage reference..................................... 41 crystal operation................................................................ 55 customer change notification service............................. 125 customer notification service .......................................... 125 customer support............................................................. 125 d data eeprom memory associated registers/bits........................................... 52 code protection.......................................................... 52 eeadr register......................................................... 49 eecon1 register ...................................................... 49 eecon2 register ...................................................... 49 eedata register....................................................... 49 data memory organization................................................... 7 dc characteristics extended and industrial.............................................. 91 industrial ..................................................................... 86 debugger ............................................................................ 69 development support ......................................................... 79 device differences............................................................ 119 device migrations ............................................................. 120 device overview................................................................... 5 e eeprom data memory reading ...................................................................... 51 spurious write ............................................................ 51 write verify ................................................................. 51 writing ........................................................................ 51 electrical specifications ...................................................... 83 errata .................................................................................... 3 f firmware instructions ......................................................... 71 g general purpose register file ............................................. 7 i id locations........................................................................ 69 in-circuit serial programming............................................. 69 indirect addressing, indf and fsr registers ................... 18 instruction format............................................................... 71 instruction set..................................................................... 71 addlw....................................................................... 73 addwf ...................................................................... 73 andlw....................................................................... 73 andwf ...................................................................... 73 bcf ............................................................................ 73 bsf............................................................................. 73 btfsc........................................................................ 73 btfss ........................................................................ 73 call........................................................................... 74 clrf .......................................................................... 74 clrw ......................................................................... 74 clrwdt .................................................................... 74 comf ......................................................................... 74 decf.......................................................................... 74 decfsz ..................................................................... 75 goto ......................................................................... 75 incf ........................................................................... 75
PIC16F630/676 ds40039d-page 122 ? 2006 microchip technology inc. incfsz ....................................................................... 75 iorlw ........................................................................ 75 iorwf ........................................................................ 75 movf.......................................................................... 76 movlw ...................................................................... 76 movwf ...................................................................... 76 nop ............................................................................ 76 retfie ....................................................................... 76 retlw ....................................................................... 76 return ..................................................................... 77 rlf ............................................................................. 77 rrf............................................................................. 77 sleep ........................................................................ 77 sublw ....................................................................... 77 subwf ....................................................................... 77 swapf ....................................................................... 78 xorlw....................................................................... 78 xorwf....................................................................... 78 summary table........................................................... 72 internal 4 mhz oscillator..................................................... 56 internal sampling switch (rss) impedance ........................ 47 internet address................................................................ 125 interrupts ............................................................................. 63 a/d converter ............................................................. 65 comparator ................................................................. 65 context saving............................................................ 66 porta........................................................................ 65 ra2/int ...................................................................... 65 summary of registers ................................................ 66 tmr0 .......................................................................... 65 m mclr .................................................................................. 58 memory organization data eeprom memory.............................................. 49 microchip internet web site .............................................. 125 migrating from other picmicro devices ............................ 120 mplab asm30 assembler, linker, librarian ..................... 80 mplab icd 2 in-circuit debugger...................................... 81 mplab ice 2000 high-performance universal in-circuit emulator ............................................................. 81 mplab ice 4000 high-performance universal in-circuit emulator ............................................................. 81 mplab integrated development environment software .... 79 mplab pm3 device programmer....................................... 81 mplink object linker/mplib object librarian .................. 80 o opcode field descriptions ............................................... 71 oscillator configurations ..................................................... 55 oscillator start-up timer (ost) .......................................... 58 p packaging ......................................................................... 115 details ....................................................................... 116 marking ..................................................................... 115 pcl and pclath ............................................................... 17 computed goto........................................................ 17 stack ........................................................................... 17 picstart plus development programmer ....................... 82 pinout descriptions PIC16F630.................................................................... 6 pic16f676.................................................................... 6 porta additional pin functions ............................................. 19 interrupt-on-change............................................ 20 weak pull-up....................................................... 19 associated registers .................................................. 25 pin descriptions and diagrams .................................. 22 porta and trisio registers ........................................... 19 portc ............................................................................... 26 associated registers .................................................. 27 power control/status register (pcon).............................. 59 power-down mode (sleep) .............................................. 68 power-on reset (por)....................................................... 58 power-up timer (pwrt) .................................................... 58 prescaler............................................................................. 31 switching prescaler assignment ................................ 31 program memory organization............................................. 7 programming, device instructions...................................... 71 r rc oscillator....................................................................... 56 reader response............................................................. 126 read-modify-write operations ............................. 71 registers adcon0 (a/d control)............................................... 45 adcon1..................................................................... 45 cmcon (comparator control) ................................... 37 config (configuration word) ................................... 54 eeadr (eeprom address) ...................................... 49 eecon1 (eeprom control) ..................................... 50 eedat (eeprom data) ............................................ 49 intcon (interrupt control)......................................... 13 ioca (interrupt-on-change porta).......................... 21 maps PIC16F630 ........................................................... 8 pic16f676 ........................................................... 8 option_reg (option) ........................................ 12, 30 osccal (oscillator calibration) ................................ 16 pcon (power control) ............................................... 16 pie1 (peripheral interrupt enable 1)........................... 14 pir1 (peripheral interrupt 1)....................................... 15 portc ....................................................................... 27 status ..................................................................... 11 t1con (timer1 control) ............................................ 34 trisc......................................................................... 27 vrcon (voltage reference control) ......................... 42 wpua (weak pull-up porta)................................... 20 reset................................................................................ 57 revision history................................................................ 119 s software simulator (mplab sim) ...................................... 80 special features of the cpu .............................................. 53 special function registers ................................................... 8 t time-out sequence ............................................................ 59 timer0................................................................................. 29 associated registers .................................................. 31 external clock............................................................. 30 interrupt ...................................................................... 29 operation .................................................................... 29 t0cki ......................................................................... 30 timer1 associated registers .................................................. 35 asynchronous counter mode ..................................... 35 reading and writing ........................................... 35 interrupt ...................................................................... 33 modes of operations .................................................. 33 operation during sleep............................................ 35 oscillator..................................................................... 35 prescaler .................................................................... 33 timer1 module with gate control ....................................... 32 timing diagrams
? 2006 microchip technology inc. ds40039d-page 123 PIC16F630/676 clkout and i/o......................................................... 96 external clock............................................................. 94 int pin interrupt.......................................................... 65 pic16f675 a/d conversion (normal mode)............. 102 pic16f675 a/d conversion timing (sleep mode). 103 reset, watchdog timer, oscillator start-up timer and power-up timer ......................................... 97 time-out sequence on power-up (mclr not tied to v dd )/ case 1 ................................................................ 62 case 2 ................................................................ 62 time-out sequence on power-up (mclr tied to v dd ).................................................... 62 timer0 and timer1 external clock ............................. 99 timer1 incrementing edge.......................................... 33 timing parameter symbology............................................. 93 trisio registers................................................................ 19 v voltage reference accuracy/error ..................................... 41 w watchdog timer summary of registers ................................................ 67 watchdog timer (wdt) ...................................................... 66 www address.................................................................. 125 www, on-line support ....................................................... 3
PIC16F630/676 ds40039d-page 124 ? 2006 microchip technology inc. notes:
? 2006 microchip technology inc. ds40039d-page 125 PIC16F630/676 the microchip web site microchip provides online support via our www site at www.microchip.com. this web site is used as a means to make files and information easily available to customers. accessible by using your favorite internet browser, the web site contains the following information: ? product support ? data sheets and errata, application notes and sample programs, design resources, user?s guides and hardware support documents, latest software releases and archived software ? general technical support ? frequently asked questions (faq), technical support requests, online discussion groups, microchip consultant program member listing ? business of microchip ? product selector and ordering guides, latest microchip press releases, listing of seminars and events, listings of microchip sales offices, distributors and factory representatives customer change notification service microchip?s customer notification service helps keep customers current on microchip products. subscribers will receive e-mail notification whenever there are changes, updates, revisions or errata related to a specified product family or development tool of interest. to register, access the microchip web site at www.microchip.com, click on customer change notification and follow the registration instructions. customer support users of microchip products can receive assistance through several channels: ? distributor or representative ? local sales office ? field application engineer (fae) ? technical support ? development systems information line customers should contact their distributor, representative or field application engineer (fae) for support. local sales offices are also available to help customers. a listing of sales offices and locations is included in the back of this document. technical support is available through the web site at: http://support.microchip.com
PIC16F630/676 ds40039d-page 126 ? 2006 microchip technology inc. reader response it is our intention to provide you with the best documentation possible to ensure successful use of your microchip prod- uct. if you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation can better serve you, please fax your comments to the technical publications manager at (480) 792-4150. please list the following information, and use this outline to provide us with your comments about this document. to : technical publications manager re: reader response total pages sent ________ from: name company address city / state / zip / country telephone: (_______) _________ - _________ application (optional): would you like a reply? y n device: literature number: questions: fax: (______) _________ - _________ ds40039d PIC16F630/676 1. what are the best features of this document? 2. how does this document meet your hardware and software development needs? 3. do you find the organization of this document easy to follow? if not, why? 4. what additions to the document do you think would enhance the structure and subject? 5. what deletions from the document could be made without affecting the overall usefulness? 6. is there any incorrect or misleading information (what and where)? 7. how would you improve this document?
? 2006 microchip technology inc. ds40039d-page 127 PIC16F630/676 product identification system to order or obtain information, e.g., on pricing or delivery, refer to the factory or the listed sales office. * jw devices are uv erasable and can be programmed to any device configuration. jw devices meet the electrical requirement of each oscillator type. part no. x /xx xxx pattern package temperature range device device: : standard v dd range t: (tape and reel) temperature range: i= -40 c to +85 c e= -40 c to +125 c package: p=pdip sn = soic (gull wing, 150 mil body) st = tssop(4.4 mm) pattern: 3-digit pattern code for qtp (blank otherwise) examples: a) PIC16F630 ? e/p 301 = extended temp., pdip package, 20 mhz, qtp pattern #301 b) pic16f676 ? i/so = industrial temp., soic package, 20 mhz
ds40039d-page 128 ? 2006 microchip technology inc. americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: http://support.microchip.com web address: www.microchip.com atlanta alpharetta, ga tel: 770-640-0034 fax: 770-640-0307 boston westborough, ma tel: 774-760-0087 fax: 774-760-0088 chicago itasca, il tel: 630-285-0071 fax: 630-285-0075 dallas addison, tx tel: 972-818-7423 fax: 972-818-2924 detroit farmington hills, mi tel: 248-538-2250 fax: 248-538-2260 kokomo kokomo, in tel: 765-864-8360 fax: 765-864-8387 los angeles mission viejo, ca tel: 949-462-9523 fax: 949-462-9608 santa clara santa clara, ca tel: 408-961-6444 fax: 408-961-6445 toronto mississauga, ontario, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific asia pacific office suites 3707-14, 37th floor tower 6, the gateway habour city, kowloon hong kong tel: 852-2401-1200 fax: 852-2401-3431 australia - sydney tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing tel: 86-10-8528-2100 fax: 86-10-8528-2104 china - chengdu tel: 86-28-8665-5511 fax: 86-28-8665-7889 china - fuzhou tel: 86-591-8750-3506 fax: 86-591-8750-3521 china - hong kong sar tel: 852-2401-1200 fax: 852-2401-3431 china - qingdao tel: 86-532-8502-7355 fax: 86-532-8502-7205 china - shanghai tel: 86-21-5407-5533 fax: 86-21-5407-5066 china - shenyang tel: 86-24-2334-2829 fax: 86-24-2334-2393 china - shenzhen tel: 86-755-8203-2660 fax: 86-755-8203-1760 china - shunde tel: 86-757-2839-5507 fax: 86-757-2839-5571 china - wuhan tel: 86-27-5980-5300 fax: 86-27-5980-5118 china - xian tel: 86-29-8833-7250 fax: 86-29-8833-7256 asia/pacific india - bangalore tel: 91-80-4182-8400 fax: 91-80-4182-8422 india - new delhi tel: 91-11-4160-8631 fax: 91-11-4160-8632 india - pune tel: 91-20-2566-1512 fax: 91-20-2566-1513 japan - yokohama tel: 81-45-471- 6166 fax: 81-45-471-6122 korea - gumi tel: 82-54-473-4301 fax: 82-54-473-4302 korea - seoul tel: 82-2-554-7200 fax: 82-2-558-5932 or 82-2-558-5934 malaysia - penang tel: 60-4-646-8870 fax: 60-4-646-5086 philippines - manila tel: 63-2-634-9065 fax: 63-2-634-9069 singapore tel: 65-6334-8870 fax: 65-6334-8850 taiwan - hsin chu tel: 886-3-572-9526 fax: 886-3-572-6459 taiwan - kaohsiung tel: 886-7-536-4818 fax: 886-7-536-4803 taiwan - taipei tel: 886-2-2500-6610 fax: 886-2-2508-0102 thailand - bangkok tel: 66-2-694-1351 fax: 66-2-694-1350 europe austria - wels tel: 43-7242-2244-3910 fax: 43-7242-2244-393 denmark - copenhagen tel: 45-4450-2828 fax: 45-4485-2829 france - paris tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany - munich tel: 49-89-627-144-0 fax: 49-89-627-144-44 italy - milan tel: 39-0331-742611 fax: 39-0331-466781 netherlands - drunen tel: 31-416-690399 fax: 31-416-690340 spain - madrid tel: 34-91-708-08-90 fax: 34-91-708-08-91 uk - wokingham tel: 44-118-921-5869 fax: 44-118-921-5820 w orldwide s ales and s ervice 08/29/06


▲Up To Search▲   

 
Price & Availability of PIC16F630

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X